The nFlags parameter contains the key's scan code and zero or more of the bit flags described here:
Bit(s) Meaning Description
0_7 OEM scan code 8-bit OEM scan code
8 Extended key flag 1 if the key is an extended key, 0 if it is not
9_12 Reserved N/A
13 Context code 1 if the Alt key is pressed, 0 if it is not
14 Previous key state 1 if the key was previously pressed, 0 if it was up
15 Transition state 0 if the key is being pressed, 1 if it is being released
The extended key flag allows an application to differentiate between the duplicate keys that appear on most keyboards. On the 101-key and 102-key keyboards used with the majority of IBM-compatible PCs, the extended key flag is set for the Ctrl and Alt keys on the right side of the keyboard; the Home, End, Insert, Delete, Page Up, Page Down, and arrow keys that are clustered between the main part of the keyboard and the numeric keypad; and the keypad's Enter and forward-slash (/) keys. For all other keys, the extended key flag is 0. The OEM scan code is an 8-bit value that identifies the key to the keyboard BIOS. Most Windows applications ignore this field because it is inherently hardware dependent. (If needed, scan codes can be translated into virtual key codes with the ::MapVirtualKey API function.) The transition state, previous key state, and context code are generally disregarded too, but they are occasionally useful. A previous key state value equal to 1 identifies typematic keystrokes—keystrokes generated when a key is pressed and held down for some length of time. Holding down the Shift key for a second or so, for instance, generates the following sequence of messages:
Partager