ListBox_SetCaretIndex macro

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. You can use this macro or send the LB_SETCARETINDEX message explicitly.

Syntax


int ListBox_SetCaretIndex(
   HWND hwndCtl,
   int  index
);

Parameters

hwndCtl

Type: HWND

A handle to the control.

index

Type: int

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

Return value

If an error occurs, the return value is LB_ERR.

Remarks

The contents of the list box are scrolled till the item is fully visible.

For more information, see LB_SETCARETINDEX.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Windowsx.h

 

 

Show: