How to implement an outgoing interface on a sink object (C++)
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:
Without:
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 https://bitbucket.org/sofusmortensen/comet/ or http://www.lambdasoft.dk/comet/.
链接地址: http://www.djcxy.com/p/81304.html