beautypg.com

Ipetrace* pe_trace – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual

Page 119

background image

Teledyne LeCroy

Automation API for PETracer/PETrainer

114

C++:

IPETrace* pe_trace;


. . .

IAnalyzerErrors* analyser_errors;
try
{

analyser_errors = pe_trace->AnalyzerErrors(error_type).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;

}

TCHAR all_errors[2048];
_stprintf( all_errors, _T("Errors: ") );
try
{

long errors_count = analyser_errors->GetCount();
long analyzer_error;
if ( !errors_count )
{

_tcscat( all_errors, _T("none") );

}
for ( long i=0; i{

analyzer_error = analyser_errors->GetItem(i);
TCHAR cur_error[32];
_stprintf( cur_error, _T(" %ld"), analyzer_error );
_tcscat( all_errors, cur_error );

}
if ( i>2048/32 )

_tcscat( all_errors, _T(" ...") );

}
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;

}

analyser_errors->Release();

::SetWindowText( m_hwndStatus, all_errors );