Windows CE includes two kinds of messages for keyboard events: keystroke messages, which generally control a windows behavior, and character messages, which determine the text that is displayed in the window.
Windows CE generates a keystroke message whenever the user presses or releases a key. When the user presses a key, the system generates either a WM_KEYDOWN or WM_SYSKEYDOWN message. If the user holds a key down long enough to start the keyboard's automatic repeat feature, the system will generate repeated WM_KEYDOWN or WM_SYSKEYDOWN messages. When the user releases a key, a WM_KEYUP or WM_SYSKEYUP message is generated.
System keystroke messages are generated when the user types a key in combination with the ALT key or when the user types a key and the focus is NULL. If the focus is NULL, the keyboard event is delivered to the active window. These messages have the WM_SYS prefix in the message name.
Windows CE does not automatically generate character messages. An application's message loop calls TranslateMessage to generate character messages. TranslateMessage translates the keyboard message into the appropriate character message. Not all keystroke messages generate character messages.
Windows CE includes four character messages: WM_CHAR, WM_SYSCHAR, WM_DEADCHAR and WM_SYSDEADCHAR. The WM_CHAR message contains the character and flags that provide other information. Applications that display characters that the user types from a keyboard process the WM_CHAR message.
Some non-English keyboards provide keys that enable the user to add diacritic marks to characters produced by subsequent keystrokes. In these cases, the system generates a WM_DEADCHAR message when the diacritic key is pressed. When the user presses a subsequent key, Windows CE generates a single WM_CHAR message if the diacritic and character can be combined, or two WM_CHAR messages if they cannot be combined. Applications typically do not process WM_DEADCHAR messages.
The system generates corresponding WM_SYSCHAR and WM_SYSDEADCHAR messages if the keystroke is a WM_SYSKEY style message. Applications usually do not process these messages.