3 out of 5 rated this helpful - Rate this topic

CB_SETCURSEL message

Applies to: desktop apps only

An application sends a CB_SETCURSEL message to select a string in the list of a combo box. If necessary, the list scrolls the string into view. The text in the edit control of the combo box changes to reflect the new selection, and any previous selection in the list is removed.

Parameters

wParam

Specifies the zero-based index of the string to select. If this parameter is –1, any current selection in the list is removed and the edit control is cleared.

lParam

This parameter is not used.

Return value

If the message is successful, the return value is the index of the item selected. If wParam is greater than the number of items in the list or if wParam is –1, the return value is CB_ERR and the selection is cleared.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

See also

Reference
CB_FINDSTRING
CB_GETCURSEL
CB_SELECTSTRING

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Mistake in Return value
The Return Value section should also note that in the event the list is empty and WPARAM is 0, it will still return CB_ERR.
edit: to clarify, it should read: "if wParam is greater than or equal to the number of items in the list...", since it is a zero-based index.