Window's new handle

Hi! I've just begun programming with Windows and I'm trying to create a simple menu application. So far, I have been able to create the main window with a top menu (File/Help), and a few buttons (including a text[edit] box) well spaced. I was also able to pop up new windows with buttons and even have prompt for exit (Yes/No answer) working. However, I have a button which is "Option" and when we would press that button, I would like it to be possible that there is no popup, but that the whole main menu disappears and that the "new" Option menu appears. Conversely, it would be awesome to implement a "Back to the main menu" button within that Option menu.
I have searched on google for a few hours last night and tonight, I have attempted many things, but if anyone could tell me how to call that or how can that be done, it'd be super appreciated.

If you need the structure of the current program plus an overview or the overall code, I am absolutely willing to post it.

If that helps, I don't use Windows Forms, but Windows.h and WindowsX.h

Thanks in advance!
Last edited on
I am a little unclear about what you want, as I have not come across the term "(simple) menu application" before.

Am I right thinking that you to swap the a window's main mean for another (the Option menu). What triggers this is a separate issue, I would expect.

Andy
Last edited on
By menu application, I mean a program with menus (such as a main menu) and other menus with radio buttons, percentage bars, little text box, other buttons, etc. I want all of these menus in one window, overlapping each other maybe.

For example, let's say this is a game I want to create (this is the case actually). I want a main menu with 4 or 5 buttons:

New game

New map

Options

About

Exit

If you press on new game per se, I want this menu to disappear, leaving the window empty, and then I want that window to immediately fill with:

Single player campaign

Single player battle

Multiplayer campaign

Multiplayer battle

Back to main menu


And if you press on "Back to main menu", well, guess what, that menu disappears to immediately show the main menu instead. Is it more clear now? Yet I don't know how to do that. I am able to popup a brand new window with a whole new menu, but first that's not what I want, and second the "Back to main menu" button is difficult, and maybe impossible to implement ('cause I have a MainWindow.cpp class and I created a Window_2.cpp class and when the message for the first button clicked is read, it just creates a new window with that Window_2.cpp class. Since Window_2 is included in my MainWindow class, I don't want to circle include each other and so I can't put a MainWindow in my Window_2 class...).

Thanks for any help you can give!!

1. You can swap the main/alternative menu by calling SetMenu

I load the alternative menus from the resource segment in my WM_CREATE or WM_INITDIALOG handler.

It should just be a matter of defining a menu item or control to trigger the switch.

2. To show hide various controls you should probably create whole lot to begin with (or define them in resource), but then hide one set. In this case your "swap" command would hide the current set of controls and expose the other set. This is probably the simplest way for a limited number of controls and pages.

For a larger number you could consider using an embedded dialogs.

But from you comment about button, I'm still not sure I understand you.

I this for a property dialogue? Or a game startup sequence? If so a PropertySheet might make sense here.

Andy
Last edited on
This sounds exactly like what I want to do and try very soon, but I must admit, as a beginner, that I don't understand much what is an embedded dialog, or what are dialogs at all. But again, thanks a lot, I will try to simply swap pages, using setmenu and resource segments!
Dialogs are generally created from a DIALOG or DIALOGEX resource, most often as a popup window. But you can use a dialog as a child windows instead; that is, embedded in a window.
Topic archived. No new replies allowed.