CA_VariantClear
- Updated2023-02-21
- 2 minute(s) read
HRESULT CA_VariantClear (VARIANT *variant);
Purpose
Frees the contents of a variant and marks the variant as empty.
Although you can call CA_VariantClear on a variant that contains a value of any type, CA_VariantClear frees resources only when the variant contains a string (BSTR), an ActiveX object interface (LPDISPATCH), or an unknown interface (LPUNKNOWN).
CA_VariantClear always sets the variant type to VT_EMPTY.
Do not call CA_VariantClear on a variant that you have not initialized. You can initialize a variant using any of the CA_VariantSet functions.
Parameters
Output | ||
Name | Type | Description |
variant | VARIANT | Variant whose contents you want to clear. |
Return Value
Name | Type | Description |
status | HRESULT | A value indicating whether an error occurred. Negative error codes indicate function failure. Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h. The LabWindows/CVI ActiveX Library explicitly returns error codes. Other error codes in winerror.h are generated by ActiveX servers and passed on to you by the LabWindows/CVI ActiveX Library. You can use CA_GetAutomationErrorString to get the description of an error code or CA_DisplayErrorInfo to display the description of the error code. |
Additional Information
Library: ActiveX Library
Include file: cviauto.h
LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later
Examples
Refer to the following examples that use the CA_VariantClear function: