The following is a way to programatically set the text in the combo box without adding to the list box portion.
When using a combo box, if the style is CBS_DROPDOWN, users can enter any text in the edit box portion of it. There is no direct way of adding text to a combo box’s edit control without adding it to the listbox as well. Programmers usually insert the required text to the list box of the combo box and then select the text to achieve the desired result.
Because this method may be unacceptable in certain cases, the following method is useful.
Assume hCombo is the window handle of the combo box.
POINT point;point.x = 1;point.y = 1;HWND hEdit = ChildWindowFromPoint(hCombo, point);SetWindowText(hEdit,"Hello World");