what i heard is that DispatchMessage calls Windows..which in turn calls the WndProc...and in the WndProc there's a switch statment...
well how does Windows know what handle to window it is?
The handle to the appropriate window is found in the hwnd member of the MSG structure referenced by the call to DispatchMessage. The MSG structure also contains the message ID and two message parameters that DispatchMessage sends the window.
DispatchMessage generally handles messages posted using the PostMessage function. If the hwnd member is NULL, DispatchMessage, I presume, does nothing.