Skip to main content
gamedev.net
🔒 Locked

Second GUI Window for WIN32

Started by DIB Oct 24, 2005 at 9:15 AM 4 replies 550+ views
Original Post
DIB
DIB
I have looked around the forums, but haven't found what I am looking for. It seems pretty straight forward, but I haven't found a good example. Basically, what I am trying to do is have a single application with two windows open. One is the OpenGL window. That's easy enough. My implementation is a non-GLUT Win32-specific implementation very similar to the NeHe one. I want then a second window that is an IDD_PROPPAGE_MEDIUM. I have the window defined as a resource, etc, but I don't know how to bring it up along with the regular OpenGL window. Certainly this is trivial.
JY
JY
It certainly is trivial. Create the window as you would do normally, either as a popup window or as a child of your first window. I assume by your manner that you are having a problem doing just that. Perhaps you could post symptoms or even better, error messages?

"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan
DIB
DIB
I don't get any error messages or other symptoms...my window just doesn't display. I'm not a big Win32 person, so that is likely part of the problem. Basically, I created the window in Visual Studio which looks like it puts everything into a resource file. Then, I tried:

DialogBox(hInstance, MAKEINTRESOURCE(IDD_PROPPAGE_MEDIUM), HWND_DESKTOP, (DLGPROC)DialogProcess);

I'm not sure how this knows to create the specific IDD_PROPPAGE_MEDIUM that I designed or even if DialogBox is the correct function to call. The program runs just fine, opening up my OpenGL window. It just does not open the IDD_PROPPAGE_MEDIUM window that I created. What am I missing??
DIB
DIB
Moved over to the "General" Forum:

http://www.gamedev.net/community/forums/topic.asp?topic_id=353690

Emmanuel Deloget
Emmanuel Deloget
Hello,

I'm pretty sure that the problem comes from your hwnd parameter. I suggest you to use your other window handle or maybe NULL. You can check the return value of DialogBox(): if it is 0 then the problem comes from the window handle.

Note that you can avoid the storing of hInstance by using GetModuleHandle(NULL) (which will return the application HINSTANCE).

DialogBox() is used to create modal dialogs - are you sure that it is what you want to achieve? From your description, it seems that you want to have a non-modal dialog and another window running together. The function that should be used to create a modeless dialog is CreateDialog() (it shares the same parameter list, but you'll probably have to call ShowWindow() to show the dialog; you'll also have to make sure that closing the dialog will not destroy it).

HTH
DIB
DIB
CreateDialog() solved all the problems! That's what I was looking for. Thanks!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.