Page 127 - DCAP408_WEB_PROGRAMMING
P. 127
Unit 7: Character Sets, Fonts and the Keyboard
Avoid accelerators that conflict with an application's menu mnemonics, because the accelerator Notes
overrides the mnemonic, which can confuse the user. For more information about menu
mnemonics, see Menus.
If an application defines an accelerator that is also defined in the system accelerator table, the
application-defined accelerator overrides the system accelerator, but only within the context of
the application. Avoid this practice, however, because it prevents the system accelerator from
performing its standard role in the user interface. The system-wide accelerators are described in
the following list:
ALT+ESC Switches to the next application.
ALT+F4 Closes an application or a window.
ALT+HYPHEN Opens the Window menu for a document window.
ALT+PRINT SCREEN Copies an image in the active window onto the clipboard.
ALT+SPACEBAR Opens the Window menu for the application's main window.
ALT+TAB Switches to the next application.
CTRL+ESC Switches to the Start menu.
CTRL+F4 Closes the active group or document window.
F1 Starts the application's help file, if one exists.
PRINT SCREEN Copies an image on the screen onto the clipboard.
SHIFT+ALT+TAB Switches to the previous application. The user must press and hold down
ALT+SHIFT while pressing TAB.
7.11.4 Accelerators and Menus
Using an accelerator is the same as choosing a menu item: Both actions cause the system to send
a WM_COMMAND or WM_SYSCOMMAND message to the corresponding window procedure.
The WM_COMMAND message includes an identifier that the window procedure examines to
determine the source of the message. If an accelerator generated the WM_COMMAND message,
the identifier is that of the accelerator. Similarly, if a menu item generated the WM_COMMAND
message, the identifier is that of the menu item. Because an accelerator provides a shortcut for
choosing a command from a menu, an application usually assigns the same identifier to the
accelerator and the corresponding menu item.
An application processes an accelerator WM_COMMAND message in exactly the same way as
the corresponding menu item WM_COMMAND message. However, the WM_COMMAND
message contains a flag that specifies whether the message originated from an accelerator or a
menu item, in case accelerators must be processed differently from their corresponding menu
items. The WM_SYSCOMMAND message does not contain this flag.
The identifier determines whether an accelerator generates a WM_COMMAND or
WM_SYSCOMMAND message. If the identifier has the same value as a menu item in the System
menu, the accelerator generates a WM_SYSCOMMAND message. Otherwise, the accelerator
generates a WM_COMMAND message.
If an accelerator has the same identifier as a menu item and the menu item is grayed or disabled,
the accelerator is disabled and does not generate a WM_COMMAND or WM_SYSCOMMAND
message. Also, an accelerator does not generate a command message if the corresponding
window is minimized.
LOVELY PROFESSIONAL UNIVERSITY 121