title: DoModal() asserts at very first line
body: <p>I have an MFC dialog based application created inside Visual Studio 2008.</p>
  
  <pre><code>CCalendarWindowDlg dlg;
  m_pMainWnd = &amp;dlg;
  INT_PTR nResponse = dlg.DoModal();
  </code></pre>
  
  <p>When I run the application, DoModal() asserts at very first line</p>
  
  <pre><code>INT_PTR CDialog::DoModal()
  {
      // can be constructed with a resource template or InitModalIndirect
      ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
      m_lpDialogTemplate != NULL);
  }
  </code></pre>
  
  <p>Can anyone please help?</p>