DSAFEARRAY.MoveToVariantmethod
Transfers ownership of the safe array to a variant and detaches it from the class.
Syntax
FUNCTION MoveToVariant (BYVAL pvar AS VARIANT PTR) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
pvar | Pointer to the variant where the safe array will be moved. |
Return value
S_OK (0) on success or an HRESULT code on failure.
Description
Transfers ownership of the safe array to a variant and detaches it from the class.
Example
' // One-dimensional array of VT_BSTR DIM dsa AS DSAFEARRAY = DSAFEARRAY(VT_BSTR, 2, 1) dsa.PutStr(1, BSTRING("Test string 1")) DIM bsOut AS BSTRING bsout = dsa.GetStr(1) print bsOut dsa.PutStr(2, BSTRING("Test string 2")) bsOut = dsa.GetStr(2) print bsOut
DIM v AS VARIANT dsa.MoveToVariant(@v) print AfxVarToStr(@v) VariantClear @v
Reference
- Include file
DSafeArray.inc - Defined in AfxNova/DSafeArray.inc:1041
- Documented in COM/DSAFEARRAY Class.md
- Topic: DSAFEARRAY Class