DoModal () claims on the first line

I have an MFC dialog application created inside Visual Studio 2008.

CCalendarWindowDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();

When I launch the application, DoModal () states in the first line

INT_PTR CDialog::DoModal()
{
    // can be constructed with a resource template or InitModalIndirect
    ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
    m_lpDialogTemplate != NULL);
}

Can anybody help?

+3
source share
3 answers

To solve this, in the constructor of my Dialog class, I did something like

CCalendarWindowDlg::CCalendarWindowDlg ()
    :CDialog(IDD)
{
}

Note. I call the constructor of the CDialog parent class with the resource identifier of the form I want to submit.

+3
source

It seems that the resource template is missing or incorrectly displayed.

IDD CCalendarWindowDlg , .

DLL ? DLL CCalendarWindowDlg.

+1

, MFC , Visual Studio 2012. , .

:

CCalendarWindowDlg dlg(IDD_MYDIALOG);
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();

, .

+1

Source: https://habr.com/ru/post/1728009/


All Articles