Hi,
I am trying to create a combo box on a dialog using win32 api in vc++ 6.0. I added the combo box control using the dialog resource editor with type as Dropdown and owner draw set to 'No'. Then I add data to it programatically. I have the following classes
Code:
class CmbBox: public SimpleControl {
public:
CmbBox (HWND hwndParent, int id, BOOL initialState=TRUE)
: SimpleControl (hwndParent, id, initialState)
{}
void AddItem (char* buf) {
SendMessage(_hWnd, CB_ADDSTRING, (WPARAM)0, (LPARAM)buf);
}
void SetString (char buf[20])
{
SendMessage (_hWnd, WM_SETTEXT, 0, (LPARAM) buf);
}
};
Then i create the object for CmbBox in another class Controller
CmbBox _cmbSetting;
and the constructor initializes it
Controller::Controller (HWND hwnd)
: _cmbSetting (hwnd, IDC_CMBSETTING)
Then i call
_cmbSetting.AddItem("Data1");
_cmbSetting.AddItem("Data2");
But when i execute the application there is no data in the combobox. I am able to create all other controls like list box and buttons, but combo box comes up without any data.
Any pointers??
Thanks