How Keyboard Messaging Operates
When the user presses and
releases a key on the keyboard, several
hidden things happen within the messaging system. When the user
presses a key on the keyboard, the keyboard sends a scan code to the keyboard device
driver indicating that a specific key
was pressed. This device driver converts the scan code to a virtual
key code that Windows defines. A message structure is filled with
either
a WM_KEYDOWN
or WM_SYSKEYDOWN
message, according to the type of key the user pressed.
System key-down and key-up messages are produced in one of three ways:
By pressing the F10 key, which causes the menu bar to activate
By holding down the ALT key while pressing another key such as ALT-F4, which closes a window
When no window in the system has the keyboard input focus, such as when all windows are minimized
System key messages are used mainly by the system and provide a standard keyboard interface for manipulating windows. For example, pressing ALT-F4 closes a window -- you can find this key combination in a window’s system menu. Other examples of system key combinations are:
- CTRL-ESC
Opens the Windows Start menu
- CTRL-SHIFT-ESC
Opens the Windows Task Manager
- ALT-ESC
Switches to the next running application in the Z-order
- ALT-TAB
Switches to the next running application in the Z-order
- ALT-DOWN ARROW
Opens a drop-down list box
- ALT-SPACE
Displays the active window’s system menu
- ALT-F6
Switches between windows within the same application
A nonsystem key is ...
Get Subclassing and Hooking with Visual Basic now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.