Advertisement

dialog box

Started by January 11, 2004 04:18 PM
3 comments, last by dennizzz 21 years, 1 month ago
I want a dialog box to appear first when I execute my OGL application. Just for showing a picture and a run and a cancel button. And maybe some resolutions choice (not very important)... any one knows where to find a nice and easy understanding example?
The Nehe basecode pops up a dialog for the user to select whether they want fullscreen or not, why can''t you use that and modify it to suit your needs?

----------------
Amusing quote deleted at request of owner
----------------Amusing quote deleted at request of owner
Advertisement
:O) i was doing this for the last few weeks, the example i could give tho is probably very confusing,im a noob and my code isnt exactly good.

http://apache.airnet.com.au/~praisegd/miscelanious/glwindowloader_bin.zip
http://apache.airnet.com.au/~praisegd/miscelanious/glwindowloader_src.zip

hope it helps

!!My bRaiN is FiLLEd With HappY Juice!!
I you are using win32/mfc try adding a resource script (and header), then use this code to load a dialog:

CDialog d;
d.Create(IDD_MYDIALOG);
d.DoModal();

This will create a dialog and return when the user clicks yes, no, ok, cancel or exits the window otherwise (=cancel).
Just the other day, I unlazied enough to write something like this. It was rather simple, but it gets the job done. I made a small dialog window in Visual C++ 6 and saved the .rc. Then I wrote a header file for it, and now all I have to do is call one function. I''m proud of it :D

Basically, it''s a VideoSettings structure; it holds width, height, bits per pixel, and a fullscreen flag. You create a structure in the main function (or wherever you want), pass the pointer to the run function (with the handle of the instance of the application as well), and it''ll pop-up the dialog and grab settings. It''ll return one of a few predefined constants representing what button the user pressed. I use it similar to below:

#include "VideoSettings.h"// Somewhere in main functionVideoSettings vs;LRESULT Result;Result = RunVideoSettings(hInstance, &vs);if (Result == VS_ERROR){    MessageBox(NULL, "Error launching Video Settings dialog.", "Error", MB_OK | MB_ICONERROR);    // Shutdown stuff    return 0;}else if (Result == VS_EXIT){    // Quit program    return 0;}// Else, it returned VS_RUN, so run program here


Then I add the .rc file to the project.

and it looks like this:


and here''s the source if you want to use it:
VideoSettings.h
VideoSettings.rc

This topic is closed to new replies.

Advertisement