0

I have a modeless dialog. When I try and do a .DoModal() from there, it shows the dialog, but it still allows you to interact with the modeless dialog.

This is how I create modeless dialog: MyMainEditorWindow = new CMyMain(this); MyMainEditorWindow->Create(CMyMain::IDD,GetDesktopWindow()); MyMainEditorWindow->ShowWindow(SW_SHOW);

To do a modal one, from that modeless window, I do

CMyDlg myDlg; int dialogbox = myDlg.DoModal();

Is there any way to do what I want? Where in modeless window, a dialog from it makes its window wait until it's decided.

Mary Ellen Bench
  • 589
  • 1
  • 8
  • 28
  • The edit doesn't change the answer. The *modal* dialog needs to have the *modeless* dialog as it's parent. – Joel Jul 26 '13 at 18:32

1 Answers1

2

You need to set the parent window in the modal dialog's constructor. Docs for CDialog constructor say that if you set it to NULL, it uses main application window as the parent, and the default if unspecified is NULL.

Joel
  • 1,135
  • 6
  • 9
  • 1
    +1 I always try to set the parent (it's almost always `this`), rather than using the default NULL – franji1 Jul 27 '13 at 22:12