modeless dialog in modal dialog?

Started by
6 comments, last by Zoomby 17 years, 9 months ago
Hi, how can I create a modeless child dialog in a modal dialog? The main message pump is bypassed, so I can't use "IsDialogMessage". How to do it? Bye, Chris
Advertisement
All I can think of would be create a seperate thread to create the dialog, and pump messages in that.
why not just use a modeless dialog?
Yes, why not do something like:

CDlg2	*pDlg2	=	new CDlg2();pDlg2->Create( IDD_DIALOG2, NULL);pDlg2->SetFocus();pDlg2->ShowWindow( SW_SHOW );


So that pDlg2 will be a modal less dialog; this function was called from a modal dialog. I had no problem with the same ( VC 6.0/ MFC Dlg based app).
If you're using MFC you don't need to do anything extra. The DoModal function of CDialog directly pumps all the threads messages.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Quote:Original post by Endurion
If you're using MFC you don't need to do anything extra. The DoModal function of CDialog directly pumps all the threads messages.

True, but DoModal wouldn't create a modal less dialog, and the parent, say dlgParent (from where this dialog was created) will only be accessable when this dialog (say dlg1) exits; whereas in case of modal less dialog, both dlgParent and dlg1 can be accessed.

If I have lesser knowledge about DoModal, then do let me know.

Thank you
Quote:Original post by Taha Ansari
Quote:Original post by Endurion
If you're using MFC you don't need to do anything extra. The DoModal function of CDialog directly pumps all the threads messages.

True, but DoModal wouldn't create a modal less dialog, and the parent, say dlgParent (from where this dialog was created) will only be accessable when this dialog (say dlg1) exits; whereas in case of modal less dialog, both dlgParent and dlg1 can be accessed.

If I have lesser knowledge about DoModal, then do let me know.

Thank you


You're correct, of course the second dialog needs to be created modeless (via the CDialog::Create function).

With DoModal i was just referring to the main dialog. I'm not sure the same would work if you'd use DialogBox (e.g. pure Win32 API) for the main dialog.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

yadango is right. I just used a modeless dialog as parent dialog and made it "modal" with EnableWindow(hwndMain,FALSE)

This topic is closed to new replies.

Advertisement