beautypg.com

Ivscriptengine vscript_engine = null – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual

Page 134

background image

Teledyne LeCroy

Automation API for PETracer/PETrainer

129

Then, after you’ve established the connection with the server, you need to 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

...

VS_RESULT res = SCRIPT_NOT_FOUND;

try

{

res = (VS_RESULT)vscript_engine ->RunVScript();

}

catch ( _com_error& er)

{

SetStatusError( er );

}


// Tear connection with the test case

vse_sink.Unadvise( vscript_engine );

...