DSAFEARRAY.Createmethod
Creates a safe array from the given VARTYPE, number of dimensions and bounds.
Syntax
FUNCTION Create (BYVAL vt AS VARTYPE, BYVAL cDims AS UINT, BYVAL prgsabound AS SAFEARRAYBOUND PTR) AS HRESULT
FUNCTION Create (BYVAL vt AS VARTYPE, BYVAL cElements AS ULONG, BYVAL lLBound AS LONG) AS HRESULT
FUNCTION Create (BYVAL vt AS VARTYPE, BYVAL cElements1 AS ULONG, BYVAL lLBound1 AS LONG, BYVAL cElements2 AS ULONG, BYVAL lLBound2 AS LONG) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
vt | The base type of the array (the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal. | |
cDims | Number of dimensions in the array. The number cannot be changed after the array is created. | |
rgsabound | Pointer to a vector of bounds (one for each dimension) to allocate for the array. | |
vt | The base type of the array (the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal. | |
cElements | Optional. Number of elements in the array. | |
lLBound | Optional. The lower bound of the array. | |
vt | The base type of the array (the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal. | |
cElements1 | Number of elements in the first dimension of the array. | |
lLBound1 | The lower bound of the first dimension of the array. | |
cElements2 | Number of elements in the second dimension of the array. | |
lLBound2 | The lower bound of the second dimension of the array. |
Return value
S_OK (0) on success or an HREUSLT code on failure.
Description
Creates a safe array from the given VARTYPE, number of dimensions and bounds.
Multidimensional array:
One-dimensional array:
Two-dimensional array:
Reference
- Include file
DSafeArray.inc - Defined in AfxNova/DSafeArray.inc:519
- Documented in COM/DSAFEARRAY Class.md
- Topic: DSAFEARRAY Class