Ra G

Ra G

  • NA
  • 10.5k
  • 0

Consume Event Generated by VB6 OCX in C#

Jul 8 2009 5:38 PM

Hello ,
Im trying to access a VB6 OCX  via C# using late bound. I am able to Invoke the Methods using the Reflection / InvokeMember . However, i do not know how to consume the events generated by the OCX. Im instantiating the OCX using the CreateInstance Method .
Code Snippet..
Type
t = Type.GetTypeFromProgID("MyOCX");
object test = Activator.CreateInstance(t);
t.InvokeMember("LaunchBrowserWindow", System.Reflection.BindingFlags.InvokeMethod, null, test, new object[] { "cnn", "www.cnn.com" });
The above code works fine  and it does Launch the Browser. If the user closes the Browser window that just opened , the OCX Triggers a "CloseWindow" event. How can i consume that event ?
Please let me know...
thanx