Hi Joerg,
DispatchMessage is not always needed. Unfortunately, I don't grok yet when DispatchMessage is required.
http://blogs.msdn.com/b/oldnewthing/archive/2004/06/08/150929.aspx "Everybody who has messed with window messaging knows that GetMessage and PeekMessage retrieve queued messages, which are dispatched to windows via DispatchMessage."
None the clearer. If I just retrieved them (they were obviously "dispatched" to my queue), why must I dispatch again? I.e. what's the kind of work that the function calling GetMessage Should/can do vs. the work to be done by whatever function DispatchMessage eventually calls?
GetMessage removes a message from the input queue, PeekMessage allows you to examine the contents of the message queue, but neither actually delivers the message to the appropriate WndProc. That's what DispatchMessage does. They're separate either because of history or because of design, but in either case, they are separate ;)
PeekMessage is useful for message pumps: it allows you to retrieve specific messages from the queue that you wish to handle yourself, without retrieving messages the main application expects to receive.
There are many references out there on Win32, but if you were to consult a book, Charles Petzold's book Programming Windows is the classic guide: http://www.charlespetzold.com/pw5/index.html
--Juan