I am trying to subscribe to C++ Sink Event in C#, here is how we did it in C++.
.h
CComPtr<IPEvents> m_pPortEvent;
DWORD m_eventNotifierCookie, m_ServerNotifierCookie;
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
.cpp
class()
BEGIN_DISPATCH_MAP( CClass, CWnd)
DISP_FUNCTION_ID(CClass, "Notify",1, OnEventNotify, VT_EMPTY, VTS_BSTR VTS_I4 VTS_BSTR)
END_DISPATCH_MAP( )
BEGIN_INTERFACE_MAP( CClass, CWnd)
INTERFACE_PART(CClass, DIID__IOnNotify, Dispatch)
END_INTERFACE_MAP()
if(SUCCEEDED(m_pPortEvent.CoCreateInstance(__uuidof(PEvents))))
{
EnableAutomation( );
m_pPortEvent->raw_AdviseCallBk(reinterpret_cast<IUnknown*>(GetIDispatch(FALSE)), _bstr_t(strComPort), &m_eventNotifierCookie);
}
How can I do the same thing in C#?

Signature
MICHAEL CARR
Zoury - 05 Jan 2005 18:31 GMT
Hi Micheal! :O)
take a look at this article
http://support.microsoft.com/kb/811645/EN-US/
and, please, post in a plain text format. ;O)

Signature
Best Regards
Yanick
I am trying to subscribe to C++ Sink Event in C#, here is how we did it in
C++.
.h
CComPtr<IPEvents> m_pPortEvent;
DWORD m_eventNotifierCookie, m_ServerNotifierCookie;
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
.cpp
class()
BEGIN_DISPATCH_MAP( CClass, CWnd)
DISP_FUNCTION_ID(CClass, "Notify",1, OnEventNotify, VT_EMPTY, VTS_BSTR
VTS_I4 VTS_BSTR)
END_DISPATCH_MAP( )
BEGIN_INTERFACE_MAP( CClass, CWnd)
INTERFACE_PART(CClass, DIID__IOnNotify, Dispatch)
END_INTERFACE_MAP()
if(SUCCEEDED(m_pPortEvent.CoCreateInstance(__uuidof(PEvents))))
{
EnableAutomation( );
m_pPortEvent->raw_AdviseCallBk(reinterpret_cast<IUnknown*>(GetIDispatch(FALS
E)), _bstr_t(strComPort), &m_eventNotifierCookie);
}
How can I do the same thing in C#?

Signature
MICHAEL CARR