Windows Dev Center

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.

SAFEARRAY* SafeArrayCreateVector(  
  VARTYPE  vt,             
  long  lLbound,           
  unsigned int  cElements  
);

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.

lLbound

The lower bound for the array. Can be negative.

cElements

The number of elements in the array.

Points to the array descriptor, or null if the array could not be created.

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.

Show:
© 2015 Microsoft