Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This message is sent by an application to add a string to the list box of a combo box. If the combo 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.

Syntax

CB_ADDSTRING 
wParam = 0; 

lParam = (LPARAM)(LPCSTR) 
lpsz;

Parameters

wParam

Not used.

lpsz

Long pointer to the null-terminated string to be added. If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the value of the lpszparameter is stored as item data rather than the string it would otherwise point to. The item data can be retrieved or modified by sending the CB_GETITEMDATAor CB_SETITEMDATAmessage.

Return Value

The zero-based index to the string in the list box of the combo box indicates success. CB_ERR indicates that an error has occurred. CB_ERRSPACE indicates that insufficient space is available to store the new string.

Remarks

To insert a string at a specific location within the list, use the CB_INSERTSTRINGmessage.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also