Windows Mobile 6.5
A version of this page is also available for

This function creates a one-dimensional array for which the lower bound is always zero. Since a safe array created with SafeArrayCreateVector is a fixed size, the constant FADF_FIXEDSIZE is always set.

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


[in] Base type of the array (the VARTYPE of each element of the array). The type is restricted to a subset of the variant types. Neither 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.


[in] Lower bound for the array.


[in] Number of elements in the array.

Returns a pointer to a SAFEARRAY structure.

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

Both the array 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 functions.

Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.

Windows Embedded CEWindows CE 2.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions