Modeless dialog closing a modal dialog problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello!

I have a problem when a modeless CDialog is displaying a Modal dialog.
But while the modal dialog is displayed, My main window needs to close the modeless dialog (CMyModelessDialog) because it receives a certain message from the message MAP. It does so using the message myModelessDialog->PostMessage(WM_CLOSE);

So everytime the modeless dialog closes, the modal dialog cause a crash.
My modeless dialog is implemented the proper way (by overriding the PostNCDestroy , OnCancel and OnOK)

Is there anothere approach to this problem?

Thank you for any hints

Simon


MainWindow::Problem(lparam, wparam)
{
modelessDialog->PostMessage(WM_CLOSE);
}


CMyModelessDialog::DisplayResult()
{
if(error)
{
MyModalDialog d;
d.DoModal;
}
}
.



Relevant Pages

  • Re: Window display mystery
    ... I am displaying the status form with a ShowWindow call, ... which I assume must make it modeless. ... Most of my code is in a series of subroutines and functions in modules, ... > called from inside the RunLongProcess event. ...
    (microsoft.public.vb.general.discussion)
  • Re: Closing modeless dialogs
    ... No, the current thread executes a message pump, which is essential for displaying the dialog. ... The use of a modeless dialog is a simple alternative to a worker thread. ... That's the only way to let your program process messages for your dialog. ...
    (microsoft.public.vc.mfc)
  • Re: Modeless dialog closing a modal dialog problem
    ... close the pop up before it destroys itself. ... You could close the popup by sending a similar message to it if it is open. ... I have a problem when a modeless CDialog is displaying a Modal dialog. ... But while the modal dialog is displayed, My main window needs to close the modeless dialog because it receives a certain message from the message MAP. ...
    (microsoft.public.vc.mfc)
  • Re: Modeless dialog closing a modal dialog problem
    ... close the pop up before it destroys itself. ... You could close the popup by ... I have a problem when a modeless CDialog is displaying a Modal dialog. ...
    (microsoft.public.vc.mfc)
  • Re: Modeless dialog closing a modal dialog problem
    ... close the pop up before it destroys itself. ... You could close the popup by ... I have a problem when a modeless CDialog is displaying a Modal dialog. ...
    (microsoft.public.vc.mfc)