![]() ![]() ![]() No constants are defined for the virtual-key codes that match ASCII values. For the complete list of virtual-key codes, see Virtual-Key Codes. For example, the virtual-key code for the LEFT ARROW key is VK_LEFT (0x25). The header file WinUser.h defines constants for most of the virtual-key codes. In some respects this mapping is unfortunate, because you should never think of virtual-key codes as characters, for the reasons discussed. A through Z keys = ASCII 'A' – 'Z' (0x41 – 0x5A).That said, the following virtual-key codes do map to ASCII equivalents: This is obvious if you think about it, because the same key can generate different characters (a, A, á), and some keys, such as function keys, do not correspond to any character. In general, virtual-key codes do not correspond to ASCII codes or any other character-encoding standard. Pressing the A key on any keyboard generates the same virtual-key code. Virtual-key codes are device-independent. ![]() The keyboard driver translates scan codes into virtual-key codes. You will almost never care about scan codes. Scan codes vary from one keyboard to the next, and there are separate scan codes for key-up and key-down events. When you press a key, the hardware generates a scan code. á (if the keyboard supports combining diacritics)įurther, if the ALT key is held down, pressing the A key produces ALT+A, which the system does not treat as a character at all, but rather as a system command.For example, pressing the A key could result in any of the following characters. When thinking about keyboard input, it is important to remember that a key stroke is not the same as a character. Key strokes that invoke system functions for example, ALT + TAB to switch windows. Key strokes that invoke application functions for example, CTRL + O to open a file. Text that the user types into a document or edit box. The keyboard is used for several distinct types of input, including: ![]()
0 Comments
Leave a Reply. |