SafeArrayPtrOfIndex

This function returns a pointer to an array element.

At a Glance

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

Syntax

HRESULT SafeArrayPtrOfIndex(SAFEARRAY FAR* psa,
long FAR* rgIndices, void HUGEP* FAR* ppvData);

Parameters

psa

Pointer to an array descriptor created by SafeArrayCreate.

rgIndices

Array of index values that identify an element of the array. All indexes for the element must be specified.

ppvData

On return, pointer to the void pointer to the element identified by the values in rgIndices.

Return Values

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

Value Description
S_OK Success.
E_INVALIDARG The psa parameter was not a valid safe array descriptor.
DISP_E_BADINDEX The specified index was invalid.

Remarks

The array should be locked before SafeArrayPtrOfIndex is called. Failing to lock the array can cause unpredictable results. Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application.