IPortableDevicePropVariantCollection::Add method

The Add method adds an item to the collection.

Syntax


HRESULT Add(
  [inconst PROPVARIANT *pValue
);

Parameters

pValue [in]

Pointer to a new PROPVARIANT object to add to the collection. This method copies the PROPVARIANT to the collection, so you should release your local copy of the variable by calling PropVariantClear after calling this method.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription
S_OK

The method succeeded.

 

Remarks

When the VARTYPE for pValue is VT_VECTOR or VT_UI1, setting and retrieving a NULL or zero-sized buffer is not supported. For example, neither pValue.caub.pElems = NULL nor pValue.caub.cElems = 0 are allowed.

If a caller tries to add an item of a different VARTYPE contained in the collection and the PROPVARIANT value cannot be changed by this interface automatically, this method will fail. To change the collection type manually, call IPortableDevicePropVariantCollection::ChangeType.

Examples

For an example of how to use this method, see Retrieving an Object Identifier from a Persistent Unique Identifier

Requirements

Header

PortableDeviceTypes.h

Library

PortableDeviceGUIDs.lib

See also

IPortableDevicePropVariantCollection Interface
Moving Content on the Device
Retrieving an Object Identifier from a Persistent Unique Identifier

 

 

Community Additions

ADD
Show: