[C++ Win32 API] Combo Box Text

I've created a combo box:

CreateWindow("combobox","Country",...);

But in the application the combo box is blank, and the text "Country" isn't on it.

How can I make the text on the combo box say "Country" like this says "Two":
http://etcwebspace.com/users/irvm/ComboBox.jpg
?

I've searched on Google but not too sure on what the name of the message/CB_Style is, and its hard to search for something when you don't know what it's called.

Thanks in advance.

EDIT:

I'm NOT looking for how to add an item to the combo box, I already know how to do that. I want to change the text that is shown on top, when no selection of the combo box items has been made.
Last edited on
If you already have an item with the particular text, you can use the ComboBox_SetCurSel() macro, or send the CB_SETCURSEL message.
I think Ramses12's solution is probably the best:
SendMessage(m_hWnd, CB_SETCURSEL, nIndex, 0); (where nIndex is the location of the default string to display) .

More information on the macro can be found here: http://msdn.microsoft.com/en-us/library/bb856484%28v=vs.85%29.aspx

and information on the message can be found here: http://msdn.microsoft.com/en-us/library/bb775899%28VS.85%29.aspx

As for the reason why "Country" is not being displayed (I think), is that the default string might not appear, depending on styles you have set (see section: "Windows Styles of a Combo Box" @ http://www.functionx.com/win32/controls/combobox.htm ).

For a list of combo box styles see: http://msdn.microsoft.com/en-us/library/bb775796%28v=vs.85%29.aspx

I hope this helps!
Thanks everyone, I got it to work with the information given.
Topic archived. No new replies allowed.