***
That's your problem. My preference is to have the dialog be given a CWnd * of the window
to which it should report its termination. In the OnClose handler, I do a SendMessage to
this window of a user-defined message
void CMyView::LaunchDialog()
{
if(MyModelessDialog == NULL)
{ /* does not exist */
MyModelessDialog = new CMyModelessDialog;
if(!MyModelessDialog.Create(CMyModelessDialog::IDD, this))
{ /* failed */
delete MyModelessDialog;
MyModelessDialog = NULL;
return;
} /* failed */
MyModelessDialog->owner = this;
} /* does not exist */
else
{ /* already exists */
MyModelessDialog->Show(SW_SHOW);
if(MyModelessDialog->IsIconic())
MyModelessDialog->Show(SW_RESTORE);
MyModelessDialog->SetForegroundWindow();
} /* already exists */
void CMyModelessDialog::OnClose()
{
owner->SendMessage(UWM_DIALOG_CLOSING);
...rest of close code here
DestroyWindow();
}
viud CMyModelessDialog::PostNcDestroy()
{
delete this;
}
LRESULT CMyView::OnDialogClosing(WPARAM, LPARAM)
{
MyModelessDialog = NULL;
return 0;
}
****
***
See the PostNcDestroy handler, above
***
****
Not needed. Use PostNcDestroy
****
***
Because you didn't follow the correct protocol for deleting a modeless dialog
***
***
no.
***
****
You haven't said exactly what the problem is. I've never seen behavior like you describe,
and I do a lot of modeless dialogs.
****
Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web:
http://www.yqcomputer.com/
MVP Tips:
http://www.yqcomputer.com/