DPA_SortedInsertPtr macro (dpa_dsa.h)

Inserts a new item before or after a specified existing item.

Syntax

int DPA_SortedInsertPtr(
   HDPA          hdpa,
   void          *pFind,
   int           iStart,
   PFNDPACOMPARE pfnCompare,
   LPARAM        lParam,
   UINT          options,
   void          *pitem
);

Parameters

hdpa

Type: HDPA

A handle to a DPA.

pFind

Type: void*

An item pointer which is used to determine the insertion point for the new item (see Remarks).

iStart

Type: int

The index in the DPA at which to begin searching for pFind.

pfnCompare

Type: PFNDPACOMPARE

A pointer to the comparison function. See PFNDPACOMPARE or PFNDPACOMPARECONST for the comparison function prototype.

lParam

Type: LPARAM

An additional parameter used to pass information to the comparison function pointed to by pfnCompare.

options

Type: UINT

The insertion point. Must be one of the following values.

Value Meaning
DPAS_INSERTBEFORE
Insert the new item before the pFind item.
DPAS_INSERTAFTER
Insert the new item after the pFind item.

pitem

Type: void*

A pointer to the item that is to be inserted.

Return value

Type: int

Returns the index of the new item, or -1 if the insert action fails.

Remarks

Note  This macro wraps the DPA_InsertPtr and DPA_Search functions.
 
The DPAS_SORTED flag is included in options by default to indicate that the DPA is sorted.

See function DPA_Search for additional information on how the pFind item is located. The new item is inserted before or after the pFind item according to the options parameter. The pFind parameter need not exist in the DPA. If it does not exist in the DPA, then the new item is inserted where pFind would have been had it been inserted in the DPA in sorted order.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header dpa_dsa.h