SafeArrayCreateVector

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.

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

Parameters

  • vt
    [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 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] Lower bound for the array.
  • cElements
    [in] Number of elements in the array.

Return Values

This function returns a pointer to the array descriptor when successful. NULL indicates that the array could not be created.

Remarks

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 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 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 calls.

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

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oleauto.h.
Link Library: Oleaut32.lib.

See Also

VARTYPE | SAFEARRAY | SafeArrayAllocDescriptor | SafeArrayAllocData

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.