1 _ianalyzerevents::ontracecreated, Parameters, Remarks – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual
Page 140: Example, Dim currenttrace, Ianalyzerevents::ontracecreated

Teledyne LeCroy
Automation API for PETracer/PETrainer
135
11.1.1 _IAnalyzerEvents::OnTraceCreated
HRESULT OnTraceCreated (
[in] IDispatch* trace )
Fired when a trace is created. This event is a result of IAnalyzer::StartRecording and IAnalyzer::StopRecording
method calls (see Pages 10, 12).
Parameters
trace
Interface pointer to the
PETrace
object
Remarks
Make sure the event handlers have __stdcall calling convention.
Example
VBScript:
<OBJECT
ID = Analyzer
CLASSID = "clsid: 297CD804-08F5-4A4F-B3BA-779B2654B27C "
>
</OBJECT>
<P ALIGN=LEFT ID=StatusText></P>
<SCRIPT LANGUAGE="VBScript">
<!--
Dim CurrentTrace
Sub Analyzer_OnTraceCreated(ByRef Trace)
On Error Resume Next
Set CurrentTrace = Trace
If Err.Number <> 0 Then
MsgBox Err.Number & ":" & Err.Description
End If
StatusText.innerText = "Trace '" & CurrentTrace.GetName & "' created"
End Sub
-->
</SCRIPT>
C++:
HRESULT __stdcall OnTraceCreated( IDispatch* trace )
{
IPETrace* pe_trace;
HRESULT hr;
hr = trace->QueryInterface( IID_IPETrace, (void**)&pe_trace );
if (FAILED(hr))
{
_com_error er(hr);
if (er.Description().length() > 0)
::MessageBox( NULL, er.Description(), _T("PETracer client"), MB_OK );
else
::MessageBox( NULL, er.ErrorMessage(),_T("PETracer client"), MB_OK );
return hr;
}
. . .
return hr;
}