Windows Menus
A Microsoft Windows menu is a familiar application element that consists of a top-level horizontal list of menus with submenus that appear when the user selects a top-level command. Most of the time, you define for a frame window a default menu resource that loads when the window is created. You can also define a menu resource independent of a frame window. In that case, your program must call the functions necessary to load and activate the menu.A menu resource completely defines the initial appearance of a menu. Menu commands can be grayed out or have check marks, and bars can separate groups of menu commands. Multiple levels of associated menus are possible. If a first-level menu command is associated with a submenu, the menu command carries a right-pointing arrow symbol, as shown next to the Windows menu command in Figure 12-2.
Figure 12-2: Submenus (shown in Microsoft Visual C++ .NET).
Visual C++ .NET includes an easy-to-use menu-resource editing tool. This tool lets you edit menus in a WYSIWYG environment. Each menu command has a properties dialog box that defines all the characteristics of that command. The resulting resource definition is stored in the application's resource script (RC) file. Each command is associated with an ID, such as ID_FILE_OPEN, that is defined in the Resource.h file.The MFC library extends the functionality of the standard menus for Windows. Each menu command can have a prompt string that appears in the frame's status bar when the command is highlighted. These prompts are really Windows string resource elements linked to the menu command by a common ID. From the point of view of the menu editor and your program, the prompts appear to be part of the menu command definition.