WM_COMPAREITEM
idCtl = wParam; /* control identifier */
lpcis = (const COMPAREITEMSTRUCT FAR*) lParam; /* structure */
The WM_COMPAREITEM message determines the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, Windows sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style.
idCtl
Value of wParam. Specifies the identifier of the control that sent the WM_COMPAREITEM message.
lpcis
Value of lParam. Points to a COMPAREITEMSTRUCT data structure that contains the identifiers and application-supplied data for two items in the combo box or list box. The COMPAREITEMSTRUCT structure has the following form:
typedef struct tagCOMPAREITEMSTRUCT { /* cis */
UINT CtlType;
UINT CtlID;
HWND hwndItem;
UINT itemID1;
DWORD itemData1;
UINT itemID2;
DWORD itemData2;
} COMPAREITEMSTRUCT;
The return value indicates the relative position of the two items. It may be any of the following values:
Value | Meaning |
–1 | Item 1 precedes item 2 in the sorted order. |
0 | Item 1 and item 2 are equivalent in the sorted order. |
1 | Item 1 follows item 2 in the sorted order. |
When the owner of an owner-drawn combo box or list box receives this message, the owner returns a value indicating which of the items specified in the COMPAREITEMSTRUCT structure should appear before the other. Typically, Windows sends this message several times until it determines the exact position for the new item.