IPortableDeviceValues::GetValue method

The GetValue method retrieves a PROPVARIANT value specified by a key.

Syntax

HRESULT GetValue(
  [in]  REFPROPERTYKEY key,
  [out] PROPVARIANT    *pValue
);

Parameters

key [in]

A REFPROPERTYKEY key that specifies the item to retrieve.

pValue [out]

Pointer to the retrieved PROPVARIANT value. The caller must release the memory by calling PropVariantClear when done with it.

Return value

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

Return code Description
S_OK
The method succeeded.
HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
The property specified by key is not in the collection.

Remarks

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

This method can be used to retrieve a value of any type from the collection. However, if you know the value type in advance, use one of the specialized retrieval methods of this interface to avoid the overhead of working with PROPVARIANT values directly.

Requirements

Requirement Value
Header
PortableDeviceTypes.h
Library
PortableDeviceGUIDs.lib

See also

IPortableDeviceValues Interface

IPortableDeviceValues::RemoveValue

IPortableDeviceValues::SetValue