WM_CHAR Messages

When your Windows program needs to process characters from the keyboard (for instance, in a word-processing or communications program), it will process WM_CHAR messages. You'll probably want some special processing for the Backspace, Tab, and Enter keys (and perhaps the Linefeed key), but you'll treat all other characters the same:

case WM_CHAR :

switch (wParam)

{

case '\b' : // backspace

[other program lines]

break ;

case '\t' : // tab

[other program lines]

break ;

case '\n' : // linefeed

[other program lines]

break ;

case '\r' : // carriage return

[other program lines]

break ;

default : // character code

[other program lines]

break ;

}

return 0 ;

This program fragment is virtually identical to keyboard character processing in regular MS-DOS programs.