Sign in to follow this  
Anton Vatchenko

How to run one dialog from another (WinAPI)?

Recommended Posts

I create one dialog: DialogBox(hInstance, MAKEINTRESOURCE(IDD_PROJECT_SETTINGS), hWnd, Project_Settings_Proc); Then I try create some child dialog, even like MessageBox, but it is shown as inactive. How to make it active and able to get some actions?

Share this post


Link to post
Share on other sites
The DialogBox() function creates a modal dialog, which means it does not return control to the processing thread until it's done it's own little thing. If you're trying to create your other child windows beyond the call to the DialogBox() function, then you'll have troubles. So, like...

DialogBox();

CreateWindow(blahblah);

In the above case, CreateWindow() won't be called until after the dialog box created by the DialogBox() function has been destroyed. But even if you were trying to create other windows from within the message proc of the DialogBox(), they still won't show, I think, because the thing is modal.

In other words... Try doing a modeless dialog box using the CreateDialog() function instead.

Share this post


Link to post
Share on other sites
I mean my dialog is working, and the second dialog is shown too, but it's inactive! CreateDialog() did not help me: MessageBox(hDlg, "123", 0, MB_OK); in DialogProc creates a message box where I see OK button but can't press it!

Share this post


Link to post
Share on other sites
Omega147 has already answered your question, the fact is DialogBox () invoke a modal dialog that (in general) take over control of the main window and doesn't return until you call EndDialog (). What you want is probably a modeless dialog by CreateDialog ().

An example for this is you can only interact with a message box one at a time, which is a modal dialog.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anton Vatchenko
I mean my dialog is working, and the second dialog is shown too, but it's inactive! CreateDialog() did not help me: MessageBox(hDlg, "123", 0, MB_OK); in DialogProc creates a message box where I see OK button but can't press it!


Can you show us your code please?

[edit: core != code; sorry for the typo]

Regards,

[Edited by - Emmanuel Deloget on March 4, 2006 5:06:16 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this