Help Center

DSAFEARRAY.Createmethod

Creates a safe array from the given VARTYPE, number of dimensions and bounds.

COMmethodDSafeArray.incdocumented

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

NameDescription
vtThe 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.
cDimsNumber of dimensions in the array. The number cannot be changed after the array is created.
rgsaboundPointer to a vector of bounds (one for each dimension) to allocate for the array.
vtThe 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.
cElementsOptional. Number of elements in the array.
lLBoundOptional. The lower bound of the array.
vtThe 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.
cElements1Number of elements in the first dimension of the array.
lLBound1The lower bound of the first dimension of the array.
cElements2Number of elements in the second dimension of the array.
lLBound2The 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