This topic is 4403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
All I can think of would be create a seperate thread to create the dialog, and pump messages in that.

##### Share on other sites
why not just use a modeless dialog?

##### Share on other sites
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).

##### Share on other sites
If you're using MFC you don't need to do anything extra. The DoModal function of CDialog directly pumps all the threads messages.

##### Share on other sites
Quote:
 Original post by EndurionIf 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

##### Share on other sites
Quote:
Original post by Taha Ansari
Quote:
 Original post by EndurionIf 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.

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

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631781
• Total Posts
3002319
×