Article ID: 193099
Article Last Modified on 8/7/2007
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
// ...
if (hWnd == NULL)
{
// ...
// .. dump some debug information
return FALSE;
}
ASSERT(hWnd == m_hWnd);
return TRUE;
}
MFC code for Visual C++ 6.0:
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
// ...
// Help with error diagnosis (only if WM_INITDIALOG didn't
// EndDialog())
if (hWnd == NULL && (m_nFlags & WF_CONTINUEMODAL)) // <--- PROBLEM!!!
{
// ... dump some debug information.
return FALSE;
}
ASSERT(hWnd == m_hWnd);
return TRUE;
}
// Create a modeless dialog box. In this example, m_pModeless is a
// member variable of type CModeless where CModeless is a CDialog-
// derived class. IDD_MODELESS is the ID number of a dialog-box template
// resource.
m_pModeless = new CModeless;
if (m_pModeless->Create(IDD_MODELESS, this) &&
::IsWindow(m_pModeless->m_hWnd))
{
// ... succeeded in dialog-box creation.
}
else
{
// ... failed in dialog-box creation.
}
BOOL CAdderDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
EndDialog(-1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Keywords: kbfunctions kbqfe kbbug kbdlg kbfix kbnoupdate kbvc600sp1fix kbvs600sp1fix KB193099