Windows message boxes

Started by
3 comments, last by Jesper T 22 years, 7 months ago
I suppose this goes in the General programming forum, even though its about windows programming. Im developing a little app, and Ipromt the user for screen modes b4 the program starts like this: if (MessageBox(NULL,"Run 1600x1200 ?", "Fullscreen",MB_YESNO|MB_ICONQUESTION)==IDNO) { if(MessageBox(NULL,"Run 1024x768 ?", "Fullscreen",MB_YESNO|MB_ICONQUESTION)==IDNO) { if(MessageBox(NULL,"Run 640x480 ?", "Fullscreen",MB_YESNO|MB_ICONQUESTION)==IDNO) { MessageBox(NULL,"Resolution set to 320x240","Fullscreen",MB_OK|MB_ICONEXCLAMATION); resHori = 320; resVert = 240; } else { resHori = 640; resVert = 480; } } else { resHori = 1024; resVert = 768; } } else { resHori = 1600; resVert = 1200; } As you can see, this way is a bit inefficient as youll have to go through several ''no''s if u want to run 640x480 .. I want to make a box where there is one button for each mode. Is this hard to do? If its fairly simple, mayby someone could explain how to do that, or if it is more complicated could someone direct me to tutorials/information. Thanks 4 any help. JT
Advertisement
OK, here''s where I say, use the resource editor with VC++. Create the dialog that way, and just call it with the following:

DialogBox(hInst, (LPCTSTR)IDD_MYDIALOG, hWnd, (DLGPROC)MyDialogProcName);

or, you could use CreateDialog(). I''d suggest DialogBox, as you want it to be modal most likely.

If you want to create the whole window from scratch (though I wouldn''t suggest it), just ask later on.
Hmm resource editor.. what might that be?
*starts up vc++ , finds a resource editor thingy*
Cool, I didnt know about that. Thanks for the info
For more info on resources a good tutorial is here.

Invader X
Invader''s Realm
great, thanks

This topic is closed to new replies.

Advertisement