Skip to content

GetSerialNumber

Get the serial number of the current instrument or the instrument that is simulated.

virtual CString GetSerialNumber() const abstract;

Returns the current instrument serial number.

The value returned by this function is established by implementation of the InitializeIdentification function. By default, that function parses the *IDN? result to retrieve detailed information about the connected instrument.

The following example demonstrates use of the GetSerialNumber function.

CoAcme4321.cpp
HRESULT Acme4321::Configure()
{
HRESULT hr = S_OK;
// This method is NOT supported by instruments with serial numbers that end in "X"
CString strSerial = GetSerialNumber();
if (strSerial.Right(1) == _T("X"))
return err.ModelNotSupported(GetModel());
hr = InstrPrintCommand();
return hr;
}