Processing Keystroke Messages
The window procedure of the window that has the keyboard focus receives
keystroke messages when the user types at the keyboard. The keystroke messages are
WM_KEYDOWN,
WM_KEYUP,
WM_SYSKEYDOWN, and
WM_SYSKEYUP. A typical window procedure ignores all keystroke messages except WM_KEYDOWN.
Windows posts the WM_KEYDOWN message when the user presses a key.
When the window procedure receives the WM_KEYDOWN message, it should examine
the virtual-key code that accompanies the message to determine how to process
the keystroke. The virtual-key code is in the message's
wParam parameter. Typically, an application processes only keystrokes generated by
noncharacter keys, including the function keys, the cursor movement keys, and
the special-purpose keys such as INS, DEL, HOME and END.
The following example shows the window procedure framework that a typical
application uses to receive and process keystroke messages.
case WM_KEYDOWN:
switch (wParam) {
case VK_LEFT:
.
. /* Process the LEFT ARROW key. */
.
break;
case VK_RIGHT:
.
. /* Process the RIGHT ARROW key. */
.
break;
case VK_UP:
.
. /* Process the UP ARROW key. */
.
break;
case VK_DOWN:
.
. /* Process the DOWN ARROW key. */
.
break;
case VK_HOME:
.
. /* Process the HOME key. */
.
break;
case VK_END:
.
. /* Process the END key. */
.
break;
case VK_INSERT:
.
. /* Process the INS key. */
.
break;
case VK_DELETE:
.
. /* Process the DEL key. */
.
break;
case VK_F2:
.
. /* Process the F2 key. */
.
break;
.
. /* Process other noncharacter keystrokes. */
.
default:
break;
}
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database