2 ianalyzer::openfile, Opens a trace file, and creates the petrace object, Parameters – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual
Page 12: Return values, Remarks, Example, Ianalyzer::openfile

Teledyne LeCroy
Automation API for PETracer/PETrainer
7
3.1.2 IAnalyzer::OpenFile
 
HRESULT OpenFile ( 
[in] BSTR file_name, 
[out, retval] IDispatch** trace ) 
 
Opens a trace file, and creates the PETrace object. 
 
Parameters 
 
file_name
String providing the full pathname to the trace file
trace
Address of a pointer to the
PETrace object interface
Return values
ANALYZERCOMERROR_UNABLEOPENFILE
Unable to open file
Remarks
PETrace
object is created via this method call, if the call was successful.
Example
 
WSH: 
 
CurrentDir = Left( WScript.ScriptFullName, InstrRev( WScript.ScriptFullName, “\” ) ) 
Set Analyzer = WScript.CreateObject( “CATC.PETracer” ) 
Set Trace = Analyzer.OpenFile( CurrentDir & "Input\errors.pex" ) 
 
C++: 
 
HRESULT hr; 
IPEAnalyzer* poPEAnalyzer; 
 
// create PEAnalyzer object 
if ( FAILED( CoCreateInstance( 
 CLSID_PEAnalyzer, 
 NULL, CLSCTX_SERVER, 
 IID_IPEAnalyzer, 
 (LPVOID *)&poPEAnalyzer ) ) 
 
return;
 
// open trace file 
IDispatch* trace; 
try 
{ 
trace = poPEAnalyzer->OpenFile( m_szRecFileName ).Detach();
} 
catch ( _com_error& er) 
{ 
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 1;
}
 
 
// query for VTBL interface 
IPETrace* pe_trace; 
hr = trace->QueryInterface( IID_IPETrace, (LPVOID *)&pe_trace ); 
trace->Release(); 
 
if( FAILED(hr) ) 
 
return;
