Results 1 to 4 of 4

Thread: Code example of accessing RR (SetUserVar, Execute) from a C# console program

  1. #1
    Variable Bitrate
    Join Date
    Nov 2006
    Posts
    265

    Code example of accessing RR (SetUserVar, Execute) from a C# console program

    I have a C# console program that I would like to have get and set user variables in RR.

    I know I am missing something because if I use the code provided with the C# plugin example, I get the following execution error:

    Code:
    COM target does not implement IDispatch
    The program in question can't be made into a DLL for a number of reasons.

    Anyone have a C# sample of a console program that access RR?

    Regards,
    Jim
    Last edited by obrienj; 06-14-2012 at 11:27 PM.

  2. #2
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,255
    you should be able to make an exe, and create the rr sdk obj...

    you can talk to RR

    v = SDK.GetUserVar("blabla")
    SDK.SetUserVar("blabla", "1")
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

  3. #3
    Variable Bitrate
    Join Date
    Nov 2006
    Posts
    265
    Mitch,

    That is exactly what I did.

    I created a Console app under Visual C# Express 2008.

    I copied the SDK class source from the RR Plugins C# example.

    I activate that class in "main" with

    Code:
           if (SDK.Created == false) {
                        SDK.SetSDK();
                    }

    I made no changes to the default properties or build configuration except for the .exe output directory and to build for x86.

    The app compiled fine.

    When I run it, I get the "COM target does not implement IDispatch" on the first attempt to use any of the RR SDK methods.

    Curiously, if instead of a Console app, I make a Windows Form app, it works fine in the main part of the app, but fails if I try to call RR from a thread that I create in the Window Form app.

    I even tried an old code fragment from either you or guino and it failed. That code is somewhat similar to the plugin SDK code:

    Code:
    // In main
    
    System.Type SDKType = System.Type.GetTypeFromProgID("RoadRunned.SDK");
    object SDK = System.Activator.CreateInstance(SDKType);
    
    
    // invoke RR
    private String RRcom ( cmd, message ) {
    	Object o = SDKType.InvokeMember(cmd, System.Reflection.BindingFlags.InvokeMethod, null, SDK, new object[] { message });
    	return (string) o;
    }
    I am at a loss.

    What am I missing?

    Have there been any changes to the RR COM object?

    I am using .Net 3.5 on Windows 7 Pro on both 64bit and 32bit machines with the same result.

    Regards,
    Jim

  4. #4
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,255
    I dont know jim, it just works

    here is my demo for ya


    oh, you poped a zip on my ftp.... it was corrupted, failed crc
    Attached Files Attached Files
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

Similar Threads

  1. trying to tune - console beta expired - code?
    By vp_electricity in forum Car Audio
    Replies: 2
    Last Post: 01-29-2011, 03:53 AM
  2. Execute application from within RR?
    By k1hog in forum Road Runner
    Replies: 2
    Last Post: 01-25-2008, 09:58 AM
  3. execute on down, stop or execute some else on up
    By polomaniac in forum RR Skins
    Replies: 4
    Last Post: 07-05-2006, 10:47 AM
  4. help with c++ - trying to execute a bat
    By aoLhaTer in forum Software & Software Development
    Replies: 9
    Last Post: 09-12-2005, 08:26 PM
  5. My Traffic Program Source Code
    By veetid in forum V.O.I.C.E.S
    Replies: 20
    Last Post: 08-09-2004, 07:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •