Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Using C# and Visual Basic.net

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
TomXP411
Posts: 25
Joined: Thu Oct 30, 2008 4:13 pm

Using C# and Visual Basic.net

Post 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?
Kindt.nick
Posts: 16
Joined: Mon Dec 28, 2009 6:21 pm

Re: Using C# and Visual Basic.net

Post by Kindt.nick »

This one came in handy, thx!
Post Reply