View Full Version : dialog box in win32
02-07-2001, 02:51 PM
What I want to do is display a dialog box where the user selects the screen resolution and bit depth before the OpenGL app starts.
NeHe has this in his tutorials as a messagebox that prompts if you want to use fullscreen or not. What I want to do is make it a dialogbox with radio buttons and/or pull down lists and such. I was able to make a dialog box in the resource editor but where do I get the commands used to bring it up and accept data from it and such. I'm looking for something like the messagebox command Nehe uses but instead dialogbox or something like that. Are there any examples somewhere I can see dialog box code?
I did a search al over the net but can't find it.
That's not really an OpenGL question http://www.opengl.org/discussion_boards/ubb/biggrin.gif
Anyway, (of course) there isn't any "command" to show a dialog box, or being more precise, there is a command showing the dialog box you want!
If you are using VC++ you simply need to create a dialog with the resource editor, put the stuff you want in it (comboboxes, radio buttons) and then show it before your apps starts.
It's easyer to use MFC to do such things, so you have to use an MFC project rewriting all NeHE stuff from scratch.
Or just use pure GDI functions to access the dialog controls/data.
Just two little hints, buy a book about Visual C++, they usually explain ONLY the GDI/MFC stuff.
Beware also that this way you loose all compatibility with non MS systems (I really care about it usually).
02-08-2001, 05:30 AM
Just to add a bit more info...
If you're using MFC, do as rIO suggested and just have VC++ create a CDialog derived class for you. Then it's just a matter of
If you're using Win32, dialog boxes are really just simplified windows. You have to have a DialogProc (Like a WndProc for normal windows) and use the functions DialogBox (for modal dialogs) or CreateDialog (for modeless dialogs.
Check MSDN for info on DialogBox/CreateDialog/DialogProc. If you don't have MSDN CD's the info is online at http://www.msdn.microsoft.com
02-09-2001, 02:55 AM
Thanks guys. I know thia was a bit off topic. I will be using vanilla win32 and not MFC. I know it can be done with MFC, but I didn't want the overhead, and all the unnecessary classes MFC makes. I don't want this to turn into an MFC vs. win32 thread though so lets not stray off the subject in an already off topic post.
I think I know what to do now and I'll see if it works, if not then I'll switch to MFC or something. Thanks again. http://www.opengl.org/discussion_boards/ubb/smile.gif
I believe GLUI will do the work for you. Here is the link:
02-09-2001, 02:00 PM
Doesn't GLUI render the windows in an already existant opengl context?
To achieve what you want, it will most probably the best solution to create a Dialog resource. One that blocks the app from execution I mean. On the other hand you might want to change it while the app is running, so you can load with the last valid setting and use GLUI to change the resolution.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.