beautypg.com

7 analyzer events callback interface, 1 _ianalyzerevents dispinterface, Nalyzer – Teledyne LeCroy UWBTracer Automation Manual User Manual

Page 76: Vents, Allback, Nterface, Ianalyzerevents dispinterface, Analyzer events callback interface

background image

LeCroy

UWBTracer Automation API Reference Manual

Manual Version 3.02

72

7

Analyzer Events Callback Interface

7.1 _IAnalyzerEvents dispinterface

In order to retrieve the events from UwbAnalyzer application you must implement _IAnalyzerEvents
interface.

Since this interface is default source interface for

UwbAnalyzer

object there is very simple

implementation from such languages like Visual Basic, VBA, VBScript, WSH etc.

C++ implementation used in the examples below utilizes implements a sink object by deriving 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 which is to be handled:


class CAnalyzerSink : public IDispEventImpl
{
BEGIN_SINK_MAP(CAnalyzerSink)

//Make sure the Event Handlers have __stdcall calling convention

SINK_ENTRY(IDC_SRCOBJ, 1, OnTraceCreated)

SINK_ENTRY(IDC_SRCOBJ, 2, OnStatusReport)

END_SINK_MAP()
. . .
}

Note that due to the bug Q237771 in Microsoft

®

Active Template Library you need to implement the

GetFuncInfoFromId method:

HRESULT GetFuncInfoFromId(const IID& iid, DISPID dispidMember,LCID lcid, _ATL_FUNC_INFO& info)

{

HRESULT hr = IDispEventImpl::GetFuncInfoFromId(

iid, dispidMember, lcid, info);

if (SUCCEEDED(hr))

{

if (info.pVarTypes[dispidMember-1] == VT_USERDEFINED)

info.pVarTypes[dispidMember-1] = VT_I4;

}
return hr;

}

This implementation allows you to use

EAnalyzerState

enumerator in the callback interface.