Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

WINOLEAPI PropVariantClear(
  PROPVARIANT* 
pvar
);

Parameters

pvar

[in] Pointer to an initialized PROPVARIANTstructure for which any deallocatable elements are to be freed. On return, all zeroes are written to the PROPVARIANTstructure.

Return Values

The following table shows the return values for this function.

Value Description

S_OK

The VT types are recognized and all items that can be freed have been freed.

STG_E_INVALID_PARAMETER

The variant has an unknown VT type.

Remarks

At any level of indirection, NULL pointers are ignored. For example, the pvarparameter points to a PROPVARIANTstructure of type VT_CF. The pclipdatamember of the PROPVARIANTstructure points to a CLIPDATAstructure. The pclipDatapointer in the CLIPDATAstructure is NULL. In this example, the pclipDatapointer is ignored. However, the CLIPDATAstructure pointed to by the pclipdatamember of the PROPVARIANTstructure is freed.

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

Passing NULL as the pvarparameter produces a return code of S_OK.

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

Requirements

Header oaidl.h
Library oleaut32.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also