关于OnOpenDocument若加MessageBox后程序运行会崩溃
帮我看看阿,把MessageBox去掉就没事了,但我想跳出提示对话框后再关闭子窗口。
BOOL CMy002Doc::OnOpenDocument(LPCTSTR lpszPathName) // *** 打开文件 ***
{
//检查最近打开文件是否还存在
CFileFind finder;
if( !finder.FindFile(lpszPathName) )
{
MessageBox(NULL,"该文件已不存在!","错误提示",MB_ICONINFORMATION | MB_OK);
return FALSE;
}
pathname_dib=lpszPathName; // 保存原始文件路径
CFile file;
file.Open(pathname_dib, CFile::modeRead | CFile::shareDenyWrite, NULL);
// 调用ReadDIBFile()读取图像->全局函数中,成功返回DIB的句柄,否则返回NULL。
my_DIB = ::ReadDIBFile(file);
if (my_DIB != NULL)
InitDIBData(); // 初始化DIB
return TRUE;
}