我在 Visual Studio 2008 中创建了一个基于 MFC 对话框的应用程序。
CCalendarWindowDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
当我运行应用程序时,DoModal() 在第一行断言
INT_PTR CDialog::DoModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);
}
有人可以帮忙吗?
最佳答案
为了在我的 Dialog 类的构造函数中解决这个问题,我做了类似的事情
CCalendarWindowDlg::CCalendarWindowDlg ()
:CDialog(IDD)
{
}
请注意,我正在使用我要呈现的表单的资源 ID 调用 CDialog 父类的构造函数。
关于mfc - DoModal() 在第一行断言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2040376/