An application sends a LB_ADDSTRING message to add a string to a list box. If the list box does not have the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted.
The LB_ADDSTRING message may be used as either a wide-character message (where text arguments must use Unicode) or an ANSI message (where text arguments must use characters from the Windows 3.x character set installed).
wParam
This parameter 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 value of the lParam parameter is stored rather then the string it would otherwise point to.
The return value is the zero-based 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.
LB_INSERTSTRING, WM_COMPAREITEM