using COM Events in c++

G

Guest

I have develloped a COM component in C#. For testing it, I wrote a
testapplication in C++ ( unmanaged ), the functions are no problem but the
events are. I do not know how I can connect to the connection point that the
wrapper provides.

I don't have verry much experiance with COM, and the examples of microsoft
are not helping me understanding how to do it.

This is how I load the COM, Can You help me, how I can Implement the
eventfuntions in my C++ program that the com will fire?


HRESULT hr;
hr = CoInitialize(NULL);

try
{
hr = spPlc.CreateInstance("PlcHandlerLib.Library");
}
catch(_com_error)
{
this->MessageBox("Can not open the DLL file, first register it and restart
the application!!");
}



The next lines are from the .tli file that visualStudio created for me and
represent the eventfuntions I want to implement.


//
// dispinterface IPlcHandlerLibEvents wrapper method implementations
//

inline HRESULT IPlcHandlerLibEvents::LowLogOnFinished ( ) {
return _com_dispatch_method(this, 0xb478, DISPATCH_METHOD, VT_EMPTY,
NULL, NULL);
}

inline HRESULT IPlcHandlerLibEvents::LowLogOutFinished ( ) {
return _com_dispatch_method(this, 0xb479, DISPATCH_METHOD, VT_EMPTY,
NULL, NULL);
}


Thanks.
 

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