
Event Sink for a COM object which raises events - Proof of Concept
Thanks for your input Cramoisi?
we have a workaround of sorts, see the Thread "Capturing Outlook Events in
C#"... This is exactly the same problem.
Cheers
Alex
Quote:
> Did you try treating "OnStartup" as a event delegate?
> In the Framework SDK documentation it says:
> Simulating COM Interfaces
> IConnectionPoint and IConnectionPointContainer
> For objects that source delegate-based events (an interface for
registering
> event subscribers).
> (cpguide.chm::/html/cpconsimulatingcominterfaces.htm)
> I'm very interested in this but right now I don't have
> time to try. If it went OK please let me and everyone know
> how you did it.
> Thanks.
> > All
> > I am having a lot of problems setting up an Event Sink in C# for a VB6
Com
> > object which has events.
> > A couple of lines of code is worth more than a 1000 of words of my
> > explanation so...
> > Here is my code..
> > In an Project in vb6 I have a Class called SimpleClass (Public MultiUse)
> > Public Event OnStartup()
> > Public Sub Start()
> > RaiseEvent OnStartup
> > End Sub
> > Create as an ActiveX DLL
> > All I want to do is create the Class in C# (using the generated
> COMWrapper)
> > and be able to respond to events in my C# code... I have so far seen no
> > examples of how to do this...
> > ie.
> > In CSharp I would like to:
> > 1) Create the Object (easy can do this now) ie "SimpleClass sc = new
> > SimpleClass();"
> > 2) Attach to the Event (so far I have no idea how to do this... the
> > OnStartup event is exposed on one of the interfaces generated, but I
can't
> > seem to get to that interface! so I can't use it)
> > 3) Directly call "SimpleClass.Start()" in C#
> > 4) Respond in my C# code to the OnStartup event that is fired by 3)
> > Any pointers would be appreciated...
> > Alex