jrmcg
asked on
Initializing ComboBox inside CDialogBar
I am trying to initialize a CComboBox control in a CDialogBar created with the Resource editor. I attach the tool bar to a Child Window in an MDI app. I want to fill the contents of the CboBox when the tool bar is loaded.
This is how I am trying to do it...
-- inside CMyChildFrm::OnCreate(.... )
CComboBox* pCombo;
pCombo = (CComboBox*)GetDlgItem(IDC _COMBOBOX) ;
pCombo->AddString("SomeStr ing");
I am sure I am just overlooking something, what am I doing wrong???
The assertion error occurs when the pCombo->AddString("") is attempted. It is an Access Violation.
What is the proper casting and access method?
Thanks,
J.R.
This is how I am trying to do it...
-- inside CMyChildFrm::OnCreate(....
CComboBox* pCombo;
pCombo = (CComboBox*)GetDlgItem(IDC
pCombo->AddString("SomeStr
I am sure I am just overlooking something, what am I doing wrong???
The assertion error occurs when the pCombo->AddString("") is attempted. It is an Access Violation.
What is the proper casting and access method?
Thanks,
J.R.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, in my answer pBar will be invalid. What I meant was that pBar should be a pointer to your previously created dialogbar object.
ASKER
That did it. Thanks. I knew it would be something simple.
J.R.
J.R.