Dialog-Based Application Problem

I'm writing a Dialog-based application, not using any createWindow.
My Main Application Window always top-most eventhough not selected.

My InitInstance has

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hwnd;

Inst = hInstance;

DialogBoxParam(Inst, MAKEINTRESOURCE(IDD_MainInt), 0, (DLGPROC)Main, NULL);

ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);

return true;
}

The IDD_MainInt under the resource file (System Modal), has it's own windows frame with Min/Max/System Box.

How can I make my application windows to be NOT top-most windows?

Thanks.

Dimension
[706 byte] By [Dimension] at [2007-11-18 17:45:22]
# 1 Re: Dialog-Based Application Problem
Remove the "System Modal" property from the dialog box.
RussG1 at 2007-11-11 1:25:50 >
# 2 Re: Dialog-Based Application Problem
How about if I createWindow first, and then put my Dialog (createDialog) into it during initialization ? Will it solve the issue ? How can I do it ?
Dimension at 2007-11-11 1:26:45 >
# 3 Re: Dialog-Based Application Problem
okie. That solve my problem. What is the purpose of System Modal ?
Dimension at 2007-11-11 1:27:54 >
# 4 Re: Dialog-Based Application Problem
Purpose of system modal is to make the window the topmost window and to suspend processing of all other applications until you respond to the window. Is is meant for system error messages, etc, (it is handled differently on different version of Windows).
RussG1 at 2007-11-11 1:28:51 >
# 5 Re: Dialog-Based Application Problem
Another issue is that, the Sub-windows (Sub-Dialog Box) is always on Top of the Main Application Windows eventhough not selected. I understand this is common. Can I make it that the sub-Dialog Box is not top most of the Main Application Windows ?

Thanks.
Dimension at 2007-11-11 1:29:48 >
# 6 Re: Dialog-Based Application Problem
To do that you would want the sub-dialog box to be a modeless dialog. Create it using Create or CreateEx rather than DialogBoxParam or DoModal (or any other functions that create MODAL dialogs), etc.
RussG1 at 2007-11-11 1:30:54 >
# 7 Re: Dialog-Based Application Problem
My scenario is like this:

LRESULT CALLBACK MainFunction ( ...)
{
...
...
Case WM_COMMAND
x = LOWORD (wParam)
Switch (x)
{
...
Case IDC_BtnFunction1:
DialogBox(...)
...

Case IDC_BtnFunction2:
DialogBox(...)
...
}
}

// Handler for Function1 Box
LRESULT CALLBACK Function1
{
...
}

// Handler for Function2 Box
LRESULT CALLBACK Function2
{
...
}

When Click Function1 button, the Function1 Dialog Box appear within the sub-frame of Main windows, at the same time, I'm unable to click Function2 button until I cancel the Function1 Dialog Box. Why like this ? I want to be able to click Function1 and Function2 button anytime without have cancel the dialog box first.

And also How to make the Dialog Box move parallel with the Main Windows ? e.g When drag/move the main windows, the dialog box will also move at the same time ?
Dimension at 2007-11-11 1:31:59 >
# 8 Re: Dialog-Based Application Problem
That is what modal means. It is like with the system modal property I allready explained. A modal dialog becomes the topmost window in your application and prevents interaction with the main window until you close the dialog. The reason is because modal dialogs are usually used for either the main application window themselves, or for settings pages, etc, where the dialog can be used to change settings that affect the main application window, where keeping that window on top makes sense.

Again, if you do not want that behavoir you need to use modeless dialogs (you could use CreateDialog to do this).
Take a look here for some info on creating a modeless dialog using Win32 API (which it looks like you are doing) as things are a little different for modeless dialogs with the Dialog Procedure and message pumping, etc:
Modeless Dialogs (http://winprog.org/tutorial/modeless_dialogs.html)

As for moving the dialogs along with the main application window. You would have to handle the WM_MOVING message of your main window, and move your dialog accordingly there.
RussG1 at 2007-11-11 1:32:59 >