Add Menu Items for Add, Refresh, and Delete

In the following procedure, you will add three new menu items to Enroll’s Record menu: Add, Refresh and Delete. The command IDs you assign to the new menu items are application-specific IDs, not predefined by the framework as are ID_RECORD_FIRST and the other commands on the Record menu.

Tip   You may find it helpful to “pin down” the Menu Item Properties dialog box during the following procedure.

To add menu items for the commands

  1. In ResourceView, expand the Enroll resources folder, and then expand the Menu folder.

  2. Open the IDR_MAINFRAME menu resource.

  3. From the View menu, click Properties to open the Menu Item Properties dialog box. Pin it to keep it open.

  4. At the top of the existing Record menu items, add an “Add” menu item with the following caption, resource ID, and command prompt:
    • &Add

    • ID_RECORD_ADD

    • Add a new section
  5. Below the new Add menu item, add a “Refresh” menu item with the following caption, resource ID, and command prompt:
    • &Refresh \tEsc

    • ID_RECORD_REFRESH

    • Cancel changes on form, or cancel Add

    The “\t Esc” coding specifies that the ESC key can be used as an accelerator. If you do not complete the next procedure, Add an Accelerator for the Refresh Command, don’t include this code.

  6. Below the new Refresh menu item, add a “Delete” menu item with the following caption, resource ID, and command prompt:
    • &Delete

    • ID_RECORD_DELETE

    • Delete section
  7. Below the new Delete menu item, add a separator:
    • Insert a new menu item and, in the Menu Item Properties dialog box, click the Separator checkbox.
  8. Save your work and leave the menu editor window open.

    You will need the editor open to establish a context when you use ClassWizard to create command handler functions for the menu commands you have just added.

The following figure shows the completed menu in the menu editor.

The Record Menu with New Commands