Skip to content

GetInstanceIndex

Gets the zero-based index of the repeated capability instance.

int GetInstanceIndex() const;

Returns the zero-based index of the repeated capability instance.

The following example demonstrates use of the GetInstanceIndex function.

CoAcme4321.cpp
HRESULT Acme4321::Configure(double dOffset)
{
HRESULT hr = S_OK;
// Format the command using the repeated capability index
// GetInstanceIndex() is 0-based, the SCPI command is 1-based
hr = io.Printf(_T("CH%d:OFFS %.15g"), GetInstanceIndex() + 1, dOffset);
return hr;
}