LB_SETCARETINDEX message

Sets the focus rectangle to the item at the specified index in a multiple-selection list box. If the item is not visible, it is scrolled into view.

Parameters

wParam

Specifies the zero-based index of the list box item that is to receive the focus rectangle.

Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a list box is limited only by available memory.

lParam

If this value is FALSE, the item is scrolled until it is fully visible; if it is TRUE, the item is scrolled until it is at least partially visible.

Return value

If an error occurs, the return value is LB_ERR (-1). Otherwise, LB_OKAY (0) is returned.

Remarks

If this message is sent to a single-selection list box that does not contain a selected item, the caret index is set to the item specified by the wParam parameter. If the single-selection list box does contain a selected item, the list box returns LB_ERR.

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

LB_GETCARETINDEX