Upravit

Sdílet prostřednictvím


COMPAREITEMSTRUCT structure (winuser.h)

Supplies the identifiers and application-supplied data for two items in a sorted, owner-drawn list box or combo box.

Whenever an application adds a new item to an owner-drawn list box or combo box created with the CBS_SORT or LBS_SORT style, the system sends the owner a WM_COMPAREITEM message. The lParam parameter of the message contains a long pointer to a COMPAREITEMSTRUCT structure. Upon receiving the message, the owner compares the two items and returns a value indicating which item sorts before the other.

Syntax

typedef struct tagCOMPAREITEMSTRUCT {
  UINT      CtlType;
  UINT      CtlID;
  HWND      hwndItem;
  UINT      itemID1;
  ULONG_PTR itemData1;
  UINT      itemID2;
  ULONG_PTR itemData2;
  DWORD     dwLocaleId;
} COMPAREITEMSTRUCT, *PCOMPAREITEMSTRUCT, *LPCOMPAREITEMSTRUCT;

Members

CtlType

Type: UINT

An ODT_LISTBOX (owner-drawn list box) or ODT_COMBOBOX (an owner-drawn combo box).

CtlID

Type: UINT

The identifier of the list box or combo box.

hwndItem

Type: HWND

A handle to the control.

itemID1

Type: UINT

The index of the first item in the list box or combo box being compared. This member will be –1 if the item has not been inserted or when searching for a potential item in the list box or combo box.

itemData1

Type: ULONG_PTR

Application-supplied data for the first item being compared. (This value was passed as the lParam parameter of the message that added the item to the list box or combo box.)

itemID2

Type: UINT

The index of the second item in the list box or combo box being compared.

itemData2

Type: ULONG_PTR

Application-supplied data for the second item being compared. This value was passed as the lParam parameter of the message that added the item to the list box or combo box. This member will be –1 if the item has not been inserted or when searching for a potential item in the list box or combo box.

dwLocaleId

Type: DWORD

The locale identifier. To create a locale identifier, use the MAKELCID macro.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header winuser.h (include Windows.h)

See also

Combo Boxes

Conceptual

MAKELCID

Other Resources

Reference

WM_COMPAREITEM