Item Property

The Item property returns the specified object from a collection of SoftUSBConfiguration objects. This property is read-only.

This property is read-only.

Syntax

HRESULT get_Item(
  [in]           VARIANT Index,
  [out, retval]  SOFTUSBConfiguration **ppSoftUSBConfig
);

Property Value

ItemIndexVARIANTThe index of the item to recover from the collectionppSoftUSBConfigSOFTUSBConfigurationA SoftUSBConfiguration pointer to the object that Item returns. The caller must release this pointer.HRESULTItem returns an HRESULT value. This property returns one of the following values:S_OKItem returned the object correctly.E_INVALIDARGThe Index parameter was not valid.E_POINTER The ppSoftUSBConfig parameter was not a valid pointer.

Error Codes

Item returns an HRESULT value. This property returns one of the following values:

Name Meaning
S_OK

Item returned the object correctly.

E_INVALIDARG

The Index parameter was not valid.

E_POINTER

The ppSoftUSBConfig parameter was not a valid pointer.

Remarks

The following C++ code example shows how to get an ISoftUSBConfiguration from an ISoftUSBConfigurations collection.

HRESULT CTestDevice::GetFirstConfiguration(ISoftUSBConfiguration **ppiConfig)
{
HRESULT hr = S_OK;
VARIANT varIndex; ::InitVariant(&varIndex);
ISoftUSBConfigurations  *piConfigList = NULL;

 if (NULL == ppiConfig)
{
 hr = E_POINTER;
 goto Exit;
}

//Initialize the incoming parameter
*ppiConfig = NULL;

hr = m_Device->get_Configurations(&piConfigList);
if(FAILED(hr))
 goto Exit;


// Set up the variant to recover the current configuration
 varIndex.vt = VT_I4;
 varIndex.lVal = 1;

 hr = piConfigList->get_Item(   varIndex, reinterpret_cast<SoftUSBConfiguration**>(ppiConfig));
 
 if(FAILED(hr))
 goto Exit;

Exit:
 if (NULL != piConfigList)
{
  piConfigList->Release();
 piConfigList = NULL;
}
 return hr;
}

Requirements

Header

SoftUSBif.h

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010