CComSafeArray::Create

Creates a CComSafeArray.

HRESULT Create( 
   const SAFEARRAYBOUND * pBound, 
   UINT uDims = 1  
); 
HRESULT Create( 
   ULONG ulCount = 0, 
   LONG lLBound = 0  
);

Parameters

  • pBound
    A pointer to a SAFEARRAYBOUND object.

  • uDims
    The number of dimensions in the array.

  • ulCount
    The number of elements in the array.

  • lLBound
    The lower bound value; that is, the index of the first element in the array.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

A CComSafeArray object can be created from an existing SAFEARRAYBOUND structure and the number of dimensions, or by specifying the number of elements in the array and the lower bound. If the array is to be accessed from Visual C++, the lower bound should be 0. Other languages may allow other values for the lower bound (for example, Visual Basic supports arrays with elements with a range such as -10 to 10).

Requirements

Header: atlsafe.h

See Also

Reference

CComSafeArray Class

CComSafeArray::Destroy

Other Resources

CComSafeArray Members