ListBox_SelectItemData macro (windowsx.h)

Searches a list box for an item that has the specified item data. If a matching item is found, the item is selected. You can use this macro or send the LB_SELECTSTRING message explicitly.

Syntax

int ListBox_SelectItemData(
   HWND   hwndCtl,
   int    indexStart,
   LPARAM data
);

Parameters

hwndCtl

Type: HWND

A handle to the control.

indexStart

Type: int

The zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues searching from the top of the list box back to the item specified by the indexStart parameter. If indexStart is –1, the entire list box is searched from the beginning.

data

Type: LPARAM

The item data to find.

Return value

Type: int

If the search is successful, the return value is the index of the selected item. If the search is unsuccessful, the return value is LB_ERR and the current selection is not changed.

Remarks

For more information, see LB_SELECTSTRING.

Requirements

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