Sasvscriptengine object events, Ivscriptengineevents interface – Teledyne LeCroy SAS_SATA Automation API manual User Manual
Page 132

Teledyne LeCroy
SASVScriptEngine Object Events
126
Automation API for Teledyne LeCroy SAS/SATA Protocol Suite
SASVScriptEngine Object Events
_IVScriptEngineEvents Interface
To retrieve event notifications from the Teledyne LeCroy SAS/SATA Protocol Suite
application when a verification script engine object is running the script, you must
implement the _IVScriptEngineEvents callback interface. Since this interface is a default
source interface for the SASVScriptEngine object, there is a very simple implementation
from languages such as Visual Basic, VBA, VBScript, and WSH.
Some script engines impose restrictions on handling events from “indirect” automation
objects in typeless script languages (when an automation interface to the object is
obtained from a call of some method, rather than from creation function, such as
CreateObject() in VBScript). The SAS/SATA Protocol Suite application provides a special
COM class, allowing receiving and handling of notifications from a VSE object even in
script languages not supporting event handling from "indirect" objects.
Example
The C++ implementation used in the examples below implements an event sink object by
deriving it from IdispEventImpl, but not specifying the type library as a template
argument. Instead, the type library and default source interface for the object are
determined using AtlGetObjectSourceInterface().
A SINK_ENTRY() macro is used for each event from each source interface that is to be
handled:
Example
C++:
class CVSEngineSink : public
IDispEventImpl
{
public:
...
BEGIN_SINK_MAP(CVSEngineSink)
// Make sure the Event Handlers have __stdcall calling
convention.
SINK_ENTRY( IDC_SRCOBJ_VSE, 1, OnVScriptReportUpdated )
SINK_ENTRY( IDC_SRCOBJ_VSE, 2, OnVScriptFinished )
SINK_ENTRY( IDC_SRCOBJ_VSE, 3, OnNotifyClient )
END_SINK_MAP()
HRESULT __stdcall OnVScriptReportUpdated ( BSTR
newLine, int TAG );
HRESULT __stdcall OnVScriptFinished( BSTR script_name,
VS_RESULT result,
int TAG );
HRESULT __stdcall OnNotifyClient (int eventId, VARIANT
eventBody, int TAG);