views:

407

answers:

1

I have a predefined TLB file, with IS8SimulationEvents wrapper method implementations, for instance:

inline HRESULT IS8SimulationEvents::S8SimulationReset ( ) {
    HRESULT _result = 0;
    _com_dispatch_method(this, 0x1, DISPATCH_METHOD, VT_ERROR, (void*)&_result, NULL);
    return _result;
}

Using Oleview, I can see the IConnectionPointContainer interface attached to the COM object.

Question:

  • How do I implement the outgoing interface on a sink object, for the client to receive event notification from the COM object

Without:

  • ATL
  • MFC
+2  A: 

This article explain how to implement connections points sources/sinks in plain C http://www.codeproject.com/KB/COM/com_in_c5.aspx

Probably the whole series of articles "COM in plain C" by Jeff Glatt are more than recommended if you want to understand COM at the low level.

PD: Lambdasoft Comet is a framework that implement COM wrappers that doesn't make use of ATL/MFC, it is pretty dated but if you want something simple it worth to take a look http://www.lambdasoft.dk/comet/.

Ismael
Thanks - can you produce a simple illustration?
Aaron
Each article from CP contains a sample project, it is much better than anything that I can provide. Download it, compile and test what is it behavior, so you can hack around it.
Ismael
Shame - the file is no longer available :(
Aaron
The sample project is there, but you have to be a registered user.
Ismael
OK Xhantt, thanks. But I'm actually looking for a pure C++ implementation. I've managed to automate the application, I just need to figure out how to adapt it to handle events notifications from the COM object Server...
Aaron