Expand Minimize

SafeArrayCreateVector function

Creates a one-dimensional array. A safe array created with SafeArrayCreateVector is a fixed size, so the constant FADF_FIXEDSIZE is always set.

Syntax


SAFEARRAY* SafeArrayCreateVector(
  _In_  VARTYPE vt,
  _In_  LONG lLbound,
  _In_  ULONG cElements
);

Parameters

vt [in]

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.

lLbound [in]

The lower bound for the array. This parameter can be negative.

cElements [in]

The number of elements in the array.

Return value

A safe array descriptor, or null if the array could not be created.

Remarks

SafeArrayCreateVector allocates a single block of memory containing a SAFEARRAY structure for a single-dimension array (24 bytes), immediately followed by the array data. All of the existing safe array functions work correctly for safe arrays that are allocated with SafeArrayCreateVector.

A SafeArrayCreateVector is allocated as a single block of memory. Both the SafeArray descriptor and the array data block are allocated contiguously in one allocation, which speeds up array allocation. However, a user can allocate the descriptor and data area separately using the SafeArrayAllocDescriptor and SafeArrayAllocData calls.

Requirements

Header

OleAuto.h

Library

OleAut32.lib

DLL

OleAut32.dll

See also

SafeArrayCreate
SafeArrayDestroy

 

 

Community Additions

ADD
Show:
© 2014 Microsoft