Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rotud

Ctl3d in dialog boxes

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is probably not the right place to ask this question, but it has been bothering me for a while. At the beginning of my DirectX 7 based game, I want to have a dialog box. I made a dialog box resource(using Visual C++ 6), making sure to check the "3D Look" checkbox, and I use the DialogBox() function to use it. However, it is white, non 3d, and cannot be moved or resized. The controls within it, however, work properly. Why isn''t it 3D? Am I doing something wrong?

Share this post


Link to post
Share on other sites
Advertisement
There isn''t enough information there really...is the source closed or could I see it - give my 5 mins with VC++6 and your source and i''m sure I could fix it

Share this post


Link to post
Share on other sites
It turns out that the dialog was in fact 3D, but the dialog box color was white, not the default light-gray color. I did manage to fix the problem by intercepting the WM_CTLCOLORDLG message in the DialogProc callback function and returning GetStockObject(LTGRAY_BRUSH). However, I have seen numerous programs that use dialog boxes, and they do not have to intercept that message. Here are parts of my source:

LRESULT CALLBACK MainDialogProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
{
case WM_CTLCOLORDLG:
{
return (LRESULT)(HBRUSH)GetStockObject(LTGRAY_BRUSH);
}
case WM_INITDIALOG:
{
return true;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
EndDialog(hDlg, TRUE);
return true;
}
return false;
}

in winmain...

DialogBox(hinst, MAKEINTRESOURCE(IDD_MAIN), hwnd, (DLGPROC)MainDialogProc);

Why is it necessary to manually set the color to Light Gray?

Share this post


Link to post
Share on other sites
Hmmmm - thats a weird one - i''ve never even heard of a problem like that before, let alone experienced it myself.

Share this post


Link to post
Share on other sites
I have come up with a very interesting conclusion: When writing the Dialog Box Callback function, it looks something like this:

bool CALLBACK MainDialogProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);

Note the bool return value at the beggining of the line. If it is written in lowercase, the dialog box will appear white, non 3d, and will not be able to be moved or resized. If I spell it as BOOL in all caps, it will work like a normal dialog box. Any idea why that makes a difference?

Share this post


Link to post
Share on other sites
The only thing I can think of is that "bool" is 1 byte, while "BOOL" is a typedef for an int (I''m pretty sure) so I suppose Windows could be set up so that if the dialog proc returns 1 byte, it will not be 3d, and if it returns an integer, it will be 3d. That''s weird, but it''s all I can think of...

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!