beautypg.com

Teledyne LeCroy UWBTracer Automation Manual User Manual

Page 77

background image

LeCroy

UWBTracer Automation API Reference Manual

Manual Version 3.02

73

Then, after you have established the connection with the server, you need to advise your implementation
of the event interface:

hr = CoCreateInstance( CLSID_UwbAnalyzer, NULL,

CLSCTX_SERVER, IID_IUwbAnalyzer, (LPVOID *)&m_poUwbAnalyzer );

m_poAnalyzerSink = new CAnalyzerSink();


// Make sure the COM object corresponding to pUnk implements IProvideClassInfo2 or

// IPersist*. Call this method to extract info about source type library if you

// specified only 2 parameters to IDispEventImpl

hr = AtlGetObjectSourceInterface(m_poUwbAnalyzer, &m_poAnalyzerSink->m_lFCid,

&m_poAnalyzerSink->m_iid,

&m_poAnalyzerSink->m_wMajorVerNum,

&m_poAnalyzerSink->m_wMinorVerNum);

if ( FAILED(hr) )

return 1;


// connect the sink and source, m_poUwbAnalyzer is the source COM object

hr = m_poAnalyzerSink->DispEventAdvise(m_poUwbAnalyzer, &m_poAnalyzerSink->m_iid);

if ( FAILED(hr) )

return 1;