Virtual Keys

Using virtual keys frees the programmer from considering what type of keyboard the user will have, because the virtual-key code for the first function key should always be the same, regardless of the make or model of the keyboard. The WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, and WM_SYSKEYUP messages send the virtual-key codes as the wParam of the message.

Table 9.3 lists all of the codes and their meanings as they are defined in the Win32 API. The virtual code for the character and number keys is the same as their ASCII equivalents (in uppercase). Note that numeric keypad numbers are given different codes from the numbers on the top row of the conventional keyboard. Also, note that there is only one virtual-key code for the Shift keys. ...

Get Microsoft Windows 2000 API SuperBible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.