Errors And The Scpistringparser Object - Agilent Technologies PNA Series User And Programming Manual

Network analyzer
Hide thumbs Also See for PNA Series:
Table of Contents

Advertisement

Errors and the SCPIStringParser Object

This C++ program uses the
errorInfo object for more details.
// scpierrors.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include "afx.h"
#include "atlbase.h"
#import "C:/program files/common files/agilent/pna/835x.tlb" raw_interfaces_only,
no_namespace, named_guids
using namespace std;
HRESULT SendScpiCommand( IScpiStringParser* parser, CComBSTR& cmd, CComBSTR&
response)
{
CComBSTR bstr;
HRESULT hr = parser->Parse(CComBSTR(cmd), &response);
if (FAILED(hr))
{
// see if this interface supports ErrInfo
CComPtr<ISupportErrorInfo> spSupportsErrInfo;
if (SUCCEEDED(parser->QueryInterface(&spSupportsErrInfo)))
{
// it does, so let's get the errorinfo object
CComPtr<IErrorInfo> spErrorInfo;
if (SUCCEEDED(GetErrorInfo(0, &spErrorInfo)))
{
}
}
}
return hr;
}
SCPIStringParser.Parse
command to detect the failed HRESULT and interrogate the
CComBSTR errStr;
spErrorInfo->GetDescription(&errStr);
std::cout << "ERROR: " << CString(errStr) << std::endl;
2293

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents