Accelerator keys are single keys or key sequences that are used to represent a particular command (typically a pulldown menu item) within an application, and provide a fast path for the entry of that command. Accelerators are defined for an individual window and are active whenever that window is active. According to Systems Application Architecture CUA conventions, accelerator keys should be indicated to the user by placing the accelerator key sequence alongside the command in the pulldown menu. Accelerator keys are defined in the resource script file using the ACCELTABLE keyword, as shown in Figure "Accelerator Table Resource Definition".
The symbolic name following the ACCELTABLE statement identifies the accelerator resource, and is passed as a parameter to the WinCreateWindow() or WinCreateStdWindow() functions when the FCF_ACCELTABLE style attribute is specified for the frame window.
In the above example, the F3 key is defined as a virtual key that when pressed will generate a WM_COMMAND message with the value MI_EXIT. This is equivalent to the user having selected the "Exit" option from the menu bar. The Shift+F5 key sequence is also defined as a virtual key that will generate a WM_COMMAND message with the value MI_TILE. Note that the shifted state of the key is indicated by use of the SHIFT option. The Ctrl+D key sequence has also been defined to generate a WM_COMMAND message with the value MI_DELETE. The Ctrl state of the key is indicated by the use of the CONTROL option (in a similar manner to the SHIFT option on the previous line). The various options for defining accelerator keys are documented in the IBM OS/2 Version 2.0 Presentation Manager Reference.
As already mentioned, an accelerator table is associated with a particular window by specifying the resource identifier as a parameter to the WinCreateWindow() or WinCreateStdWindow() functions. In addition, the WinLoadAccelTable() function may be used to dynamically load an accelerator table into memory. The WinLoadAccelTable() function returns the handle of the accelerator table in memory, which may then be passed as a parameter to the WinSetAccelTable() function to activate the accelerator table for a particular queue or window.