DSAFEARRAY.PutStrmethod
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
| Name | Description | |
|---|---|---|
prgIndices | Pointer 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). | |
pData | Pointer 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. | |
bsData | A BSTRING. | |
bsData | A DVARIANT. | |
idx | Index of the element of the array. | |
pData | Pointer 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. | |
bsData | A BSTRING. | |
bsData | A DVARIANT. | |
idx | Index of the element. | |
cElem | Index of the element of the array. | |
cDim | Dimension number of the array. | |
pData | Pointer 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. | |
bsData | A BSTRING. | |
bsData | A 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