那位大侠愿意帮我这只菜鸟?
jun 2000-05-18 05:30:00 新建了一个基于对话框的应用程序,系统增加了两个类:Ctest1Dlg,Ctest1App
在对话框上放置一个CListBox控件,用classwizard为其设置一个变量:
CListBox m_ListBox;
我想在该ListBox中显示字符串,于是我在InitInstance中加了一句话,但是运行后ListBox中没有字符出现,加入UpdateData(FALSE);说该函数没有定义。去掉该函数
运行退出时出现assert错误!请大侠多指教。
BOOL Ctest1App::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
CTest1Dlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
dlg.m_ListBox.AddString("This is a test");//这句话是我增加的
//UpdateData(FALSE);
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}