7.7.1 Adding New Menus to the Resource-Definition File

You must add an Edit and a File menu to the MENU statement in the resource-definition file. The MENU statement should now look like this:

EditMenuMenu MENU
BEGIN
    POPUP        "&File"
    BEGIN
        MENUITEM    "&New",              IDM_NEW
        MENUITEM    "&Open...",          IDM_OPEN
        MENUITEM    "&Save",             IDM_SAVE
        MENUITEM    "Save &As...",       IDM_SAVEAS
        MENUITEM    "&Print",            IDM_PRINT
        MENUITEM    SEPARATOR
        MENUITEM    "E&xit",             IDM_EXIT
        MENUITEM    SEPARATOR
        MENUITEM    "&About EditMenu...",        IDM_ABOUT
    END


POPUP  "&Edit"
    BEGIN
        MENUITEM    "&Undo\tAlt+BkSp",     IDM_UNDO   ,GRAYED
        MENUITEM    SEPARATOR
        MENUITEM    "Cu&t\tShift+Del",     IDM_CUT
        MENUITEM    "&Copy\tCtrl+Ins",     IDM_COPY
        MENUITEM    "&Paste\tShift+Ins",   IDM_PASTE  ,GRAYED
        MENUITEM    "C&lear\tDel",         IDM_CLEAR  ,GRAYED
    END

END

The File menu contains seven items and two separators. Each item has a mnemonic, indicated by the ampersand (&).

The Edit menu contains five items and a separator. Each item has a mnemonic and an accelerator key, which is separated from the name by a tab (\t). Whenever an item has a corresponding accelerator key, it should be displayed in this way. In the Edit menu, the five accelerator keys are ALT+BKSP, DEL, CTRL+INS, SHIFT+INS, and SHIFT+DEL. The separator between the Undo and Cut items places a horizontal bar between these items in the menu. A separator is recommended between menu items that otherwise have nothing in common. For example, the Undo command, when chosen, affects only the application, whereas the remaining commands affect the clipboard.