Character Messages


Character Messages

Typically, a program does not intercept the keystroke messages mentioned in the previous section. The main body of a message loop in a C application usually is as shown below.

while (get_message(&message,0,0,0)
 {
  translate_message(&message);
  dispatch_message(&message);
 }

The call to the function translate_message translates keystroke messages into character messages. In particular, the messages message::key_down and message::system_key_down are translated into character messages when appropriate. The character message is placed in the queue by this function. The next call to retrieve a message obtains the newly manufactured character message. Actually, there are four different character messages, as shown in the table below.

Characters Accent Characters Related message
message::character message::accent_character message::key_down
message::system_character message::system_accent_character message::system_key_down

Generally, the accent character messages for diacritic keys (accent keys) may be ignored. This is because a subsequent character message containing the diacritic is passed to the window procedure.

The character messages are delivered to the application in between the key down and key up messages. Typically, an application only intercepts the character messages, and ignores the related keystroke messages message::key_down and message::key_up. Note that a shift key down followed by an alphabetic key down gets compressed into a single uppercase character message.