PropVariantClear function (combaseapi.h)

The PropVariantClear function frees all elements that can be freed in a given PROPVARIANT structure. For complex elements with known element pointers, the underlying elements are freed prior to freeing the containing element.

Syntax

HRESULT PropVariantClear(
  [in] PROPVARIANT *pvar
);

Parameters

[in] pvar

A pointer to an initialized PROPVARIANT structure for which any deallocatable elements are to be freed. On return, all zeroes are written to the PROPVARIANT structure.

Return value

This function returns HRESULT.

Remarks

At any level of indirection, NULL pointers are ignored. For example, the pvar parameter points to a PROPVARIANT structure of type VT_CF. The pclipdata member of the PROPVARIANT structure points to a CLIPDATA structure. The pClipData pointer in the CLIPDATA structure is NULL. In this example, the pClipData pointer is ignored. However, the CLIPDATA structure pointed to by the pclipdata member of the PROPVARIANT structure is freed.

On return, this function writes zeroes to the specified PROPVARIANT structure, so the VT-type is VT_EMPTY.

Passing NULL as the pvar parameter produces a return code of S_OK.

Note  Do not use this function to initialize PROPVARIANT structures. Instead, initialize these structures using the PropVariantInit macro (defined in Propidl.h).
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header combaseapi.h
Library Ole32.lib
DLL Ole32.dll

See also

FreePropVariantArray