Using C# and Visual Basic.net

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Using C# and Visual Basic.net

Postby TomXP411 » Thu Mar 19, 2009 4:46 pm

Here's some C# code that can invoke EventGhost (without requiring a COM reference...)
Code: Select all
   
    private void TriggerEvent(string EventName, string Payload)
    {
      Object[] Params;
      Type EventGhost = Type.GetTypeFromProgID("EventGhost");
      object myObject = Activator.CreateInstance(EventGhost);
      Params = new Object[] { EventName, Payload };
      EventGhost.InvokeMember("TriggerEvent", BindingFlags.InvokeMethod, null,
      myObject, Params);
    }


Thanks jsonnabend for pointing me to the article on .Net late binding.

Bitmonster, any chance we can put this somewhere easy to find in the Wiki?
TomXP411
 
Posts: 25
Joined: Thu Oct 30, 2008 4:13 pm

Re: Using C# and Visual Basic.net

Postby Kindt.nick » Fri Jan 20, 2012 4:09 pm

This one came in handy, thx!
Kindt.nick
 
Posts: 16
Joined: Mon Dec 28, 2009 6:21 pm


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 1 guest