If you hold down a key long enough to start the keyboard's repeat feature, the system sends multiple key-down messages, followed by a single key-up message. When you release a key, the system sends a corresponding key-up message: This includes the function keys other than F10. Some ALT key combinations do not do anything.Īll other key strokes are considered nonsystem keys and produce the WM_KEYDOWN message. In addition, if a window has a menu, the ALT key can be used to activate menu items. For example, ALT + TAB switches to a new window. Various ALT-key combinations invoke system commands. The F10 key activates the menu bar of a window. The WM_SYSKEYDOWN message indicates a system key, which is a key stroke that invokes a system command. When you press a key, the window that has keyboard focus receives one of the following messages. For example, the virtual-key code for the A key is 0x41, but there is no constant named VK_A. 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. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |