CComboBox::AddString()在VS2010下不能使用?
有一个ID为IDC_COMBO2的Combo Box;
BOOL CPro3::OnInitDialog()//某页表单的类
{
CPropertyPage::OnInitDialog();
((CComboBox*)GetDlgItem(IDC_COMBO2))->AddString(TEXT("add some string"));
return TRUE;
}
做的是孙鑫的VC++的第八个实验:用的是经典模式下的单文档,
对 ListBox:
((CListBox*)GetDlgItem(IDC_LIST1))->AddString(TEXT("add string"));可以正常工作
为什么对ComboBox作 AddString运行时(转到有ComboBox的表单页面时)报了错:
First-chance exception at 0x503129fc (mfc100ud.dll) in Prop.exe: 0xC0000005: Access violation reading location 0x00000020.
Unhandled exception at 0x503129fc (mfc100ud.dll) in Prop.exe: 0xC0000005: Access violation reading location 0x00000020.