
232.2. “Hello World” Windows Style
2.2.5 Message Loop
Windows will communicate with our program by sending it messages. ese messages may
be used to tell us about user operations, such as mouse movements or key presses, or they
may be commands from Windows. A loop in WinMain is used to check for messages (List-
ing 2.8). If our application is going to accept character input from the user, it needs to
call the TranslateMessage function inside the message loop. TranslateMessage is a
Windows function that translates virtual-key messages into character messages. e mes-
sages are sent to our WinProc function for processing by the DispatchMessage func ...