beautypg.com

5 iuwbanalyzer::openfile, Iuwbanalyzer::openfile – Teledyne LeCroy UWBTracer Automation Manual User Manual

Page 14

background image

LeCroy

UWBTracer Automation API Reference Manual

Manual Version 3.02

10

3.1.5 IUwbAnalyzer::OpenFile


HRESULT OpenFile (

[in] BSTR file_name,
[out, retval] IDispatch** trace );

Opens a trace file

Parameters

file_name

String providing the full pathname to trace file

trace

Address of a pointer to the

UwbTrace

object primary interface

Return values

ANALYZERCOMERROR_UNABLEOPENFILE

unable to open file

Remarks

UwbTrace

object is created via this method call, if call was successful.

Example

WSH:

CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Analyzer = WScript.CreateObject("CATC.UwbAnalyzer")
Set Trace = Analyzer.OpenFile (CurrentDir & "your_trace_file.uwb")


C++:

HRESULT hr;
IUwbAnalyzer* poUwbAnalyzer;

// create UwbAnalyzer object
if ( FAILED( CoCreateInstance(

CLSID_UwbAnalyzer,
NULL, CLSCTX_SERVER,
IID_IUwbAnalyzer,
(LPVOID *)&poUwbAnalyzer ) )
return;


// open trace file
IDispatch* trace;
try
{

trace = poUwbAnalyzer->OpenFile( m_szRecFileName );

}
catch ( _com_error& er)
{

if (er.Description().length() > 0)

::MessageBox( NULL, er.Description(), _T("UwbAnalyzer client"), MB_OK );

else

::MessageBox( NULL, er.ErrorMessage(), _T("UwbAnalyzer client"), MB_OK );

return 1;

}


// query for IUwbTrace interface
IUwbTrace* UWB_trace;

hr = trace->QueryInterface( IID_IUwbTrace, (LPVOID *)&UWB_trace );
trace->Release();

if( FAILED(hr) )
return;