DPA_GetPtrIndex

This function finds the index for a given item in a given DPA.

Declaration

int
DPA_GetPtrIndex (
    HDPA pdpa,
    const void *p);

Parameters

The pdpa argument provides a handle to the DPA.

The p argument provides a pointer to the item, or is NULL for an empty item.

Return Value

The function returns a 0-based index for the given item if successful, else DPA_ERR (-1).

Behaviour

The function searches the pointer array for the first occurrence of the given pointer. It returns the corresponding 0-based index.

The function fails trivially if the DPA handle is NULL or if the DPA has no pointer array.

Early Implementations

A variation is known for an early implementation. Version 4.00 merely assumes that the DPA handle is not NULL.

Availability

The DPA_GetPtrIndex function is exported from COMCTL32.DLL as ordinal 333 in version 3.50 and higher.

Though this function dates from as long ago as 1995, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

This function has, however, got documented since then (in 2006 or perhaps some time during 2005). This article now uses Microsoft’s nomenclature.