SafeArrayRedim

This function changes the right-most (least significant) bound of a safe array.

At a Glance

Header file: Oleauto.h
Windows CE versions: 2.0 and later

Syntax

HRESULT SafeArrayRedim(SAFEARRAY FAR* psa, SAFEARRAYBOUND FAR* psaboundNew);

Parameters

psa

Pointer to an array descriptor.

psaboundNew

Pointer to a new safe array bound structure that contains the new array boundary. Only the least significant dimension of an array can be changed.

Return Values

One of the values obtained from the returned HRESULT and described in the following table is returned.

Value Description
S_OK Success.
DISP_E_ARRAYISLOCKED The array is currently locked.
E_INVALIDARG The item pointed to by psa is not a safe array descriptor.

Remarks

If you reduce the bound of an array, SafeArrayRedim deallocates the array elements outside the new array boundary. If the bound of an array is increased, SafeArrayRedim allocates and initializes the new array elements. The data is preserved for elements that exist in both the old and new array. Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.