PropVariantToVariant function (propvarutil.h)

Converts the contents of a PROPVARIANT structure to a VARIANT structure.

Syntax

PSSTDAPI PropVariantToVariant(
  [in]  const PROPVARIANT *pPropVar,
  [out] VARIANT           *pVar
);

Parameters

[in] pPropVar

Type: const PROPVARIANT*

Pointer to a source PROPVARIANT structure.

[out] pVar

Type: VARIANT*

Pointer to a VARIANT structure. When this function returns, the VARIANT contains the converted information.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Normally, the data stored in the PROPVARIANT is copied to the VARIANT without a datatype change. However, in the following cases, there is no direct VARIANT support for the datatype, and they are converted as shown.

Original PROPVARIANT Type Stored as VARIANT Type
VT_BLOB, VT_STREAM VT_UNKNOWN. The punkVal member will contain a pointer to an IStream that contains the source data.
VT_LPSTR, VT_LPWSTR, VT_CLSID VT_BSTR
VT_FILETIME VT_DATE
VT_VECTOR|x VT_ARRAY|y
 

The following types cannot be converted with this function.

  • VT_STORAGE
  • VT_BLOB_OBJECT
  • VT_STREAMED_OBJECT
  • VT_STORED_OBJECT
  • VT_CF
  • VT_VECTOR | VT_CF

Requirements

Requirement Value
Minimum supported client Windows Vista, Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header propvarutil.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0