7.7.3 Adding an Accelerator Table to the Resource-Definition File

Add the following ACCELERATORS statement to the resource-definition file:

EditMenu ACCELERATORS
BEGIN
    VK_BACK,   IDM_UNDO,  VIRTKEY, ALT
    VK_DEL, IDM_CUT,   VIRTKEY, SHIFT
    VK_INS, IDM_COPY,  VIRTKEY, CONTROL
    VK_INS, IDM_PASTE, VIRTKEY, SHIFT
    VK_DEL, IDM_CLEAR, VIRTKEY
END

This statement defines five accelerator keys, one for each menu item. Four accelerators are key combinations using the ALT, SHIFT, or CTRL key.

The ACCELERATORS statement associates each accelerator key with a menu identifier. The IDM_UNDO, IDM_CUT, IDM_COPY, IDM_PASTE, and IDM_CLEAR constants identify the Edit-menu items. When the user presses an accelerator key, these are the values that are passed to the window procedure.