COM Interop

A

Abhi

Hi,

I need to fire COM events from C# and the client to handle those events is
in C++.

Following is the code snippet of the COM events and the dispinterface in C#.

[Guid("12854E47-AD44-4283-B503-1176CC827A49")]

public interface Foo1ComInterface

{

void FireRequest( string str );

}

[Guid("073D1766-7969-41fd-B794-8B65B0EADAF3")]

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

public interface Foo1ComEvents

{

void FooEvent( string str );

}

[ Guid("22EFEC33-5B40-4417-AFF0-DE0C5B7C9E47")]

[ ClassInterface(ClassInterfaceType.None) ]

[ ComSourceInterfaces(typeof(Foo1ComEvents))]

public class BooHoo : Foo1ComInterface

{

......

}

So far I have generated a tlb file using regasm and did a #import in the C++
code and am able to

call the FireRequest function as defined above from C++. But how should I
handle the event

fired from the .NET side. Please help!!!

Thanks,

Abhi
 
M

Mattias Sjögren

But how should I handle the event
fired from the .NET side. Please help!!!

That's more of a general C++/COM question, so perhaps you shold post
to microsoft.public.vc.atl or microsoft.public.win32.programmer.ole
instead. A good start would be to read about connection points in
MSDN.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top