C++ MFC add combo box string item from a widget ID
Posted
by
OzBarry
on Stack Overflow
See other posts from Stack Overflow
or by OzBarry
Published on 2012-10-11T15:21:40Z
Indexed on
2012/10/11
15:37 UTC
Read the original article
Hit count: 212
I've added a combo box in the gui editor in MSVC 2010 pro in my MFC project. I have a list of strings I am grabbing from an external source and want to add them to my combo box. I've searched for a while, and every post seems to suggest I need to use the CComboBox class, however, I have no idea how to get the class variable from the resource ID of the combobox element in the gui editor.
In summary, how do I add a string to my combo box, either using a macro (like CB_ADDSTRING(RESOURCE_ID, "my string");
) or using CComboBOx (something like CComboBox::GetObject(RESOURCE_ID)->AddString("blah");
).
I do not do much win32 api/mfc programming, and just started fiddling around with it.
© Stack Overflow or respective owner