This project is read-only.

CSExeComServer LateBinding Events

Dec 22, 2009 at 4:40 PM


First off, I'm really impressed with the quality of this tool kit.  Well done!

I've been struggling with a problem for the last several days regarding latebinding and events.  I've based my test EXE Com server off the CSExeCOMServer project and followed some suggestions found on a forum about using latebinding to get an out-of-process EXE.  The Latebinding example does not have an example of how to capture events and this has been the source of my struggles. 

Currently my test client application is written in managed C++ since all the applications I will connect this to are managed C++.  I've been able to create a sink interface matching the COM event interface and was able to "Advise" using an IConnectionPoint without error.  Unfortunately, when FloatPropertyChanging is called in the COM server during the call to set_FloatProperty it throws a TargetInvocationException. 

Is there something I'm missing here about trying to capture these out-of-process events through late binding?  I'm starting to feel like I am missing something since the example doesn't include source for late binding event handling.

Any help here would be greatly appreciated.


Dec 23, 2009 at 9:02 AM
Edited Dec 23, 2009 at 1:39 PM

Hello Jim

Thanks for the appreciation. Please try these possible solutions. I have not tested them by myself. If they do not work, please let me know.

Possible Solution1.

Step1. Try to export the type library (.tlb) from the out-of-proc COM server by using tlbexp:

tlbexp CSExeCOMServer.exe /out:CSExeCOMServer.tlb

You will get CSExeCOMServer.tlb then.

Step2. Use ATL in your C++ project to register the event. (See the ATLCOMClient sample)


Possible Solution2

Register event through .NET Reflection

I don't know whether this works for COM events, but it deserves a trial:


Jialiang Ge