LB_SELECTSTRING

This message changes the current selection to the first string that has the specified prefix.

Parameter Description  

wParam Contains the index of the item before the first item to be searched. When the search reaches the bottom of the list box it continues from the top of the list box back to the item specified by wParam. If the wParam parameter is –1, the entire list box is searched from the beginning.  
lParam Points to the prefix string. The string must have a null-terminating character.  

Return Value

The return value is the index of the selected item. The return value is LB_ERR if an error occurs.

Comments

This message must not be used with list boxes that are multiple-selection type.

A string is selected only if its initial characters (from the starting point) match the characters in the prefix string.

If the list box was created with an owner-draw style but without the LBS_HASSTRINGS style, this message returns the index of the item whose long value (supplied as the lParam parameter of the LB_ADDSTRING or LB_INSERTSTRING message) matches the value supplied as the lParam parameter of LB_FINDSTRING.