Help Center

DSAFEARRAY.CopyFromVariantmethod

Copies the contents of a VARIANT of type VT_ARRAY to the object.

COMmethodDSafeArray.incdocumented

Syntax

FUNCTION CopyFromVariant (BYVAL pvar AS VARIANT PTR) AS HRESULT

Return value

S_OK (0) on success or an HREUSLT code on failure.

Description

Copies the contents of a VARIANT of type VT_ARRAY to the object. The VARIANT remains unaltered.

pvar must be variant of type VT_ARRAY, i.e. containing a safe array. If it is of another type, an invalid data error is returned.

Remarks

CopyFromVariant calls the string or variant manipulation functions if the array to copy contains either of these data types. If the array being copied contains object references, the reference counts for the objects are incremented.

Reference

  • Include file DSafeArray.inc
  • Defined in AfxNova/DSafeArray.inc:1002
  • Documented in COM/DSAFEARRAY Class.md
  • Topic: DSAFEARRAY Class