Share via


ISoftUSBStrings::Remove Method

The Remove method removes the specified object from a collection of ISoftUSBString objects.

Syntax

HRESULT Remove(
  [in]  VARIANT Index
);

Parameters

  • Index [in]
    The index of the item to remove from the collection.

Return Value

Remove returns S_OK if the operation succeeds.

Remarks

Use the methods ISoftUSBStrings::Add and ISoftUSBStrings::Clear to add and clear items from a collection.

The following C++ code example shows how to remove an ISoftUSBString object from the collection.

HRESULT CTestDevice::RemoveSerialNumberString()
{
HRESULT hr = S_OK;
ISoftUSBStrings *piStringList = NULL;
VARIANT                varIndex; ::InitVariant(&varIndex);
// Get the string list
hr = m_piDevice->get_Strings(&piStringList);
if(FAILED(hr))
 goto Exit;

// Remove the old string from the collection
varIndex.vt = VT_I4;
varIndex.lVal = STRING_IDX_SERIALNUMBER;

hr = piStringList->Remove(varIndex);
if(FAILED(hr))
 goto Exit;

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

Requirements

Header

SoftUSBif.h

See Also

ISoftUSBString

ISoftUSBStrings

ISoftUSBStrings::Add

ISoftUSBStrings::Clear

 

 

Send comments about this topic to Microsoft

Build date: 9/21/2010