VariantCopy
This function frees the destination variant and makes a copy of the source variant.
HRESULT VariantCopy(
VARIANTARG FAR *pvargDest,
VARIANTARG FAR *pvargSrc );
Parameters
- pvargDest
Pointer to the VARIANTARG to receive the copy. - pvargSrc
Pointer to the VARIANTARG to be copied.
Return Values
One of the values obtained from the returned HRESULT and described in the following table is returned.
| Value | Description |
|---|---|
| S_OK | Success. |
| DISP_E_ARRAYISLOCKED | The variant contains an array that is locked. |
| DISP_E_BADVARTYPE | The source and destination have an invalid variant type (usually uninitialized). |
| E_OUTOFMEMORY | Memory could not be allocated for the copy. |
| E_INVALIDARG | One of the arguments is invalid. |
Remarks
Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.
First, free any memory that is owned by pvargDest, such as VariantClear (pvargDest must point to a valid initialized variant, and not simply to an uninitialized memory location). Then pvargDest receives an exact copy of the contents of pvargSrc.
If pvargSrc is a VT_BSTR, a copy of the string is made. If pvargSrc is a VT_ARRAY, the entire array is copied. If pvargSrc is a VT_DISPATCH or VT_UNKNOWN, AddRef is called to increment the object's reference count.
Requirements
| Runs on | Versions | Defined in | Include | Link to |
|---|---|---|---|---|
| Windows CE OS | 2.0 and later | Oleauto.h | Oleaut32.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
Last updated on Tuesday, July 13, 2004
© 1992-2000 Microsoft Corporation. All rights reserved.