IPropertyStore::GetValue method

Gets data for a specific property.

Syntax

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

Parameters

  • key [in]
    Type: REFPROPERTYKEY

    A reference to the PROPERTYKEY structure retrieved through IPropertyStore::GetAt. This structure contains a unique identifier for the property in question.

  • pv [out]
    Type: PROPVARIANT*

    When this method returns, contains a PROPVARIANT structure that contains the property data.

Return value

Type: HRESULT

Returns S_OK or INPLACE_S_TRUNCATED if successful, or an error value otherwise.

INPLACE_S_TRUNCATED is returned to indicate that the returned PROPVARIANT was coerced to a more canonical form, for instance to trim leading or trailing spaces from a string value. Most code should use the SUCCEEDED macro to check the return value, which treats INPLACE_S_TRUNCATED as a success code.

Remarks

If the PROPERTYKEY referenced in key is not present in the property store, this method returns S_OK and the vt member of the structure pointed to by pv is set to VT_EMPTY.

File property handler implementers can use IPropertyStore::GetValue to retrieve the property value by using the filestream with which Initialize initialized the property handler. The value can also be computed from an in-memory cache, or other means. However, most consumers of the property system obtain IPropertyStore through GetPropertyStore and are not—and have no need to be—aware of the method of initialization.

Requirements

Minimum supported client

Windows Vista [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 [desktop apps | UWP apps]

Header

Propsys.h

IDL

Propsys.idl