This function returns a pointer to an array element.

HRESULT SafeArrayPtrOfIndex(
long FAR* rgIndices, 
void HUGEP* FAR* ppvData 


  • 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

The following table shows the HRESULT values that can be returned by this function.

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


The array should be locked before SafeArrayPtrOfIndex is called. Failing to lock the array can cause unpredictable results. Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.


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

See Also

SafeArrayCreate | SafeArrayUnlock | SafeArrayLock

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.