CDialog::OnInitDialog();
在做一个加密软件。三个对话框。在为对话框添加背景的时候,对话框背景的确变了。但是我点击按钮选择文件的时候。ListBox出错了:运行到m_fileList.AddString(fileName)这句的时候出错。
由于添加第二个以后对话框的时候,VS2005没有为我自动生成OnInitDialog() ,我自己写了。而我写的时候忘了写CDialog::OnInitDialog()了。
仅仅写
BOOL EncDlg::OnInitDialog()
{}结果错了。
下面是正确的代码:
BOOL EncDlg::OnInitDialog()
{
CDialog::OnInitDialog();//没写这句话,结果后面ListBox出错。
CBitmap bmp;
bmp.LoadBitmap(IDB_frm2);
m_brBk.CreatePatternBrush(&bmp);
bmp.DeleteObject();
return true;
}
{
CDialog::OnInitDialog();//没写这句话,结果后面ListBox出错。
CBitmap bmp;
bmp.LoadBitmap(IDB_frm2);
m_brBk.CreatePatternBrush(&bmp);
bmp.DeleteObject();
return true;
}