Page 1 of 1

Using C# and Visual Basic.net

Posted: Thu Mar 19, 2009 4:46 pm
by TomXP411
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?

Re: Using C# and Visual Basic.net

Posted: Fri Jan 20, 2012 4:09 pm
by Kindt.nick
This one came in handy, thx!