A
Amernauth
Guest
Hello,
I've been trying to get a handle on configuring my Event handler and running into issues. Here's what I'm seeing ..
In Visual Studio when I use the Object Browser to view all of the classes in the namespace I see one in particular which pertains to events .. TestEventSink_Helper. When I expand that class I see an interface named TestEventSink. This interface has a few methods.. OnSyncEvent(int) is the one I'm interested in.
I'm trying to set up a handler in my code so when I receive an event from the Publisher (in this case it's the interop dll publishing the event), my subscriber handler gets called. I have this snippet in the code ..
TestEventSink onevent = new TestEventSinkHelper();
This is flagging an error stating the constructor doesn't take 0 arguments. I do also notice that the class is declared as a public sealed class? Not sure if this makes a difference or not.
I suppose the crux of the question and forgive my ignorance but what is the best practice for acting upon events from an ActiveX COM server?
I also notice another class which has an interface called TestEventSinkEvent. When I highlight that interface I see the events I am interested in leveraging so I tried this ..
TestEventSinkEvent newevent = new TestClass();
newevent.OnSyncEvent += event_handler;
This compiles but .. the OnSyncEvent publisher method takes an int as an argument. I'm confused as to how this argument gets passed in.
Thanks!
Continue reading...
I've been trying to get a handle on configuring my Event handler and running into issues. Here's what I'm seeing ..
In Visual Studio when I use the Object Browser to view all of the classes in the namespace I see one in particular which pertains to events .. TestEventSink_Helper. When I expand that class I see an interface named TestEventSink. This interface has a few methods.. OnSyncEvent(int) is the one I'm interested in.
I'm trying to set up a handler in my code so when I receive an event from the Publisher (in this case it's the interop dll publishing the event), my subscriber handler gets called. I have this snippet in the code ..
TestEventSink onevent = new TestEventSinkHelper();
This is flagging an error stating the constructor doesn't take 0 arguments. I do also notice that the class is declared as a public sealed class? Not sure if this makes a difference or not.
I suppose the crux of the question and forgive my ignorance but what is the best practice for acting upon events from an ActiveX COM server?
I also notice another class which has an interface called TestEventSinkEvent. When I highlight that interface I see the events I am interested in leveraging so I tried this ..
TestEventSinkEvent newevent = new TestClass();
newevent.OnSyncEvent += event_handler;
This compiles but .. the OnSyncEvent publisher method takes an int as an argument. I'm confused as to how this argument gets passed in.
Thanks!
Continue reading...