Teledyne-lecroy FireInspector Automation Application Programming I Manual de usuario Pagina 70

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 92
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 69
66
FireInspector Automation User’s Manual
CATC Version 1.0
2.7.1 IAnalyzerEvents dispinterface
In order to retrieve the events from FireInspector application you must implement
_IAnalyzerEvents
interface.
Since this interface is default source interface for
FwAnalyzer object there is very simple
implementation from languages such as Visual Basic, VBA, VBScript, WSH etc.
C++ implementation used in the examples below utilizes 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
AtlGe-
tObjectSourceInterface(). A
SINK_ENTRY() macro is used for each event
from each source interface which is to be handled:
class CAnalyzerSink : public IDispEventImpl<IDC_SRCOBJ,
CAnalyzerSink>
{
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()
. . .
}
Then, after you established the connection with server you need to advise your implemen-
tation of the event interface:
hr = CoCreateInstance( CLSID_FwAnalyzer, NULL,
CLSCTX_SERVER, IID_IFwAnalyzer, (LPVOID *)&m_poFwAnalyzer
);
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_poFwAnalyzer,&m_poAnalyzerSink
->m_libid,
&m_poAnalyzerSink->m_iid,
&m_poAnalyzerSink->m_wMajorVerNum,
&m_poAnalyzerSink->m_wMinorVerNum);
if ( FAILED(hr) )
return 1;
// connect the sink and source, m_poFwAnalyzer is the source
COM object
hr = m_poAnalyzerSink->DispEventAdvise(m_poFwAnalyzer,
&m_poAnalyzerSink->m_iid);
if ( FAILED(hr) )
return 1;
Vista de pagina 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 91 92

Comentarios a estos manuales

Sin comentarios