Index   Commented   Search   About

VariantCopy

pvargDest, pvargSrc)
VARIANTARG FAR* pvargDest
VARIANTARG FAR* pvargSrc

Frees the destination variant and makes a copy of the source variant.

Parameters

pvargDest

Pointer to the VARIANTARG to receive the copy.

pvargSrc

Pointer to the VARIANTARG to be copied.

Return Value

The SCODE obtained from the returned HRESULT is one of the following:

SCODE
Meaning
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
The argument pvargSrc was VT_BYREF.

Comments

First, any memory owned by pvargDest is freed as in VariantClear (note that pvargDest must point to a valid initialized variant, and not simply 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.

Related Links

Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder

More Online Helps

Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp)
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008 Free Tect Secrets ;) greatis just4fun network just4fun