beautypg.com

4 iusbtrace2::saveas, Iusbtrace2::saveas – Teledyne LeCroy USB Analyzer Automation Manual User Manual

Page 65

background image

Teledyne LeCroy Automation API Reference Manual for USBTracer, USB Advisor, and Voyager USB Protocol
Suite

65

3.2.4 IUsbTrace2::SaveAs


HRESULT SaveAs ( [in] BSTR file_name );


Saves trace into a file and makes current IUsbTrace2 pointer refer to this file.

Parameters

file_name

String providing the full pathname to file in which trace is saved

Return values

ANALYZERCOMERROR_UNABLESAVE

Unable to save trace file

Remarks

Use this method if you want to move a recorded or opened trace into a file.

Example


WSH:

Set Analyzer = WScript.CreateObject("CATC.UsbTracer")
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Analyzer.StartRecording (CurrentDir & "Input\test_ro.rec")

'... Do something.

Set Trace = Analyzer.StopRecordingAndWaitForTrace
Trace.SaveAs CurrentDir & "Output\saved_file.usb"

C++:

IUsbTrace2* USB_trace;
TCHAR file_name[_MAX_PATH];
LONG packet_from;
LONG packet_to;


...

try

{

USB_trace->SaveAs( file_name );

}
catch (_com_error& er)
{

if (er.Description().length() > 0)
::MessageBox(NULL, er.Description(), _T("UsbAnalyzer client"), MB_OK);
else
::MessageBox(NULL, er.ErrorMessage(), _T("UsbAnalyzer client"), MB_OK);
return 1;

}