WM_COMPAREITEM

Version 3.0

This message determines the relative position of a new item in a sorted owner-draw combo or list box.

Whenever the application adds a new item, Windows sends this message to the owner of a combo or list box created with the CBS_SORT or LBS_SORT style. The lParam parameter of the message is a long pointer to a COMPAREITEMSTRUCT data structure that contains the identifiers and application-supplied data for two items in the combo or list box. When the owner receives the message, the owner returns a value indicating which of the items should appear before the other. Typically, Windows sends this message several times until it determines the exact position for the new item.

Parameter

Description

 

wParam

Is not used.

 

lParam

Contains a long pointer to a COMPAREITEMSTRUCT data structure that contains the identifiers and application-supplied data for two items in the combo or list box.

 

Return Value

The return value indicates the relative position of the two items. It may be any of the following values:

Value

Meaning


–1

Item 1 sorts before item 2.

0

Item 1 and item 2 sort the same.

1

Item 1 sorts after item 2.