Keyboard Accelerators

Under Construction...

A keyboard accelerator is basically a special way of translating a key or combination of keys pressed by the user into WM_COMMAND messages like the ones your windows receive when the user clicks on a menu item. For example, most Windows programs have a menu option Copy under the Edit menu which copies the currently selected object (or objects) into the clipboard. Most programs also allow you to perform the same operation by pressing the control key (Ctrl on most keyboards) and the C key at the same time. In fact the message that is caused by the user clicking the Copy menu item and the message caused by the user pressing Ctrl+C is probably the same: a WM_COMMAND message with an ID associated with the copy operation. Windows uses a table called an accelerator table to convert keystrokes by the user into messages to send to the program. These tables are resources which you can create in a resource script and include in your programs to get similar functionality.

In a resource script accelerator tables have the following syntax:

table_id ACCELERATORS
BEGIN
    event, id, [type] [options]
    ...
END

table_id is the ID number of the acclerator table which you will use to associate the table with a window in your programs. Each row of the table contains an event, plus the id number that is sent with WM_COMMAND messages by that event. A row may also contain a type which must be either ASCII or VIRTKEY, and options.

An event is one of:

options can be one or more of:

separated by spaces. The first three are only valid if type is VIRTKEY.