This message adds a string to the list box. If the list box is not sorted, the string is added to the end of the list. If the list box is sorted, the string is inserted into the list after sorting.
This message removes any existing list-box selections.
Parameter | Description |
wParam | Is not used. | |
lParam | Points to the null-terminated string that is to be added. If the list box was created with an owner-draw style but without the LBS_HASSTRINGS style, the lParam parameter is an application-supplied 32-bit value that is stored by the list box instead of the pointer to the string. |
The return value is the index to the string in the list box. The return value is LB_ERR if an error occurs; the return value is LB_ERRSPACE if insufficient space is available to store the new string.
If an owner-draw list box was created with the LBS_SORT style but not the LBS_HASSTRINGS style, the WM_COMPAREITEM message is sent one or more times to the owner of the list box so the new item can be properly placed in the list box.