Help Center

DSAFEARRAY.PutStrmethod

COMmethodDSafeArray.incdocumented

Syntax

FUNCTION PutStr (BYVAL prgIndices AS LONG PTR, BYREF bsData AS BSTRING) AS HRESULT
FUNCTION PutStr (BYVAL idx AS LONG, BYREF bsData AS BSTRING) AS HRESULT
FUNCTION PutStr (BYVAL cElem AS LONG, BYVAL cDim AS LONG, BYREF bsData AS BSTRING) AS HRESULT
Also documented as Put — one description covers them all.

Parameters

NameDescription
prgIndicesPointer to a vector of indexes for each dimension of the array. The right-most (least significant) dimension is rgIndices(0). The left-most dimension is stored at prgIndices(@psa.cDims – 1).
pDataPointer to the data to assign to the array. The variant types VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
bsDataA BSTRING.
bsDataA DVARIANT.
idxIndex of the element of the array.
pDataPointer to the data to assign to the array. The variant types VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
bsDataA BSTRING.
bsDataA DVARIANT.
idxIndex of the element.
cElemIndex of the element of the array.
cDimDimension number of the array.
pDataPointer to the data to assign to the array. The variant types VT_DISPATCH, VT_UNKNOWN, and VT_BSTR are pointers, and do not require another level of indirection.
bsDataA BSTRING.
bsDataA DVARIANT.

Return value

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

Description

Stores the data element at a given location in the array.

Multidimensional array:

One-dimensional array:

Two-dimensional array:

Remarks

This function automatically calls SAfeArrayLock and SafeArrayUnlock before and after assigning the element. If the data element is a string, object, or variant, the function copies it correctly when the safe array is destroyed. If the existing element is a string, object, or variant, it is cleared correctly. If the data element is a VT_DISPATCH or VT_UNKNOWN, AddRef is called to increment the object's reference count.

Multiple locks can be on an array. Elements can be put into an array while the array is locked by other operations.

Reference

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