Teledyne LeCroy SAS_SATA Automation API manual User Manual

Page 133

Advertising
background image

 

Automation API for Teledyne LeCroy SAS/SATA Protocol Suite

127

SASVScriptEngine Object Events

Teledyne LeCroy

HRESULT Advise(IUnknown* pUnk)
{
AtlGetObjectSourceInterface(pUnk, &m_libid, &m_iid,

&m_wMajorVerNum,

&m_wMinorVerNum);
return DispEventAdvise(pUnk, &m_iid);
}
HRESULT Unadvise(IUnknown* pUnk)
{
AtlGetObjectSourceInterface(pUnk, &m_libid, &m_iid,

&m_wMajorVerNum,

&m_wMinorVerNum);
return DispEventUnadvise(pUnk, &m_iid);
}
...
};

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

IVScriptEngine vscript_engine = NULL;

try
{
vscript_engine = vscript ->GetVScriptEngine( "Test_1"

);

}
catch (_com_error& er )
{
SetStatusError( er );
}

if ( vscript_engine == NULL )
{
vscript = NULL;
return E_FAIL;
}

CVSEngineSink vse_sink;
HRESULT hr = vse_sink . Advise( vscript_engine );
// “Subscribe” for receiving events.

...

Advertising