The following code fragment shows a typical accelerator-table resource:

    ACCELTABLE ID_ACCEL_RESOURCE
    BEGIN
        VK_ESC,    IDM_ED_UNDO,  AF_VIRTUALKEY | AF_SHIFT
        VK_DELETE, IDM_ED_CUT,   AF_VIRTUALKEY
        VK_F2,     IDM_ED_COPY,  AF_VIRTUALKEY
        VK_INSERT, IDM_ED_PASTE, AF_VIRTUALKEY
    END

This accelerator table has four accelerator items. The first one is triggered when the user presses Shift+Esc, which sends a WM_COMMAND message (the default).

An accelerator table in a resource-definition file has an identifier (ID_ACCEL_RESOURCE in the previous example). You can associate an accelerator-table resource with a standard frame window by specifying the table's resource identifier as the idResources parameter of the WinCreateStdWindow function.

An application can load an accelerator table resource-definition file automatically when creating a standard frame window, or it can load the resource independently and associate it with a window or with the entire system.


[Back] [Next]