SafeArrayCreateVector
A version of this page is also available for
4/8/2010
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.
Syntax
SAFEARRAY * 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 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 Value
Returns a pointer to a SAFEARRAY structure.
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 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.
Requirements
Header | oleauto.h |
Library | oleaut32.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
Automation Functions
VARTYPE
SAFEARRAY
SafeArrayAllocDescriptor
SafeArrayAllocData