INF: Obtaining Index of Focused Item in Multi-Select List Box

ID Number: Q72042

3.00

WINDOWS

Summary:

Sending an LB_GETCURSEL to a single selection list box returns the

index of the currently selected item. However, this message is not

designed to be used with multiple selection list boxes. The

LB_GETCARETINDEX message is used to determine which item has the focus

in a multiple selection list box.

The LB_GETCARETINDEX message exists in Windows version 3.00 but it is

not listed in the documentation. It will be documented in the next

version of Windows.

To use LB_GETCARETINDEX with Windows 3.00, add the following line to

the code:

#define LB_GETCARETINDEX (WM_USER+32)

LB_GETCARETINDEX returns the index of the item with the focus

rectangle (dotted caret) in a multiple selection list box. wParam and

lParam are not used.