"The second argument in the call to GetMessage() is the handle of the window for which you want to get messages. This parameter can be used to retrieve messages for one application window separately from another. If this argument is NULL, as it is here, GetMessage() retrieves all messages for an application. This is an easy way of retrieving all messages for an application regardless of how many windows it has. It is also the safest way because you are sure of getting all the messages for your application. When the user of your Windows program closes the application window for example, the window is closed before the WM_QUIT message is generated. Consequently, if you only retrieve messages by specifying a window handle to the GetMessage() function, you cannot retrieve the WM_QUIT message and your program is not able to terminate properly."
What is that last part describing. Can anyone simplify it? Very confused
It means that if you specify the Window handle, you'll only get messages for that Window. It then explains why you'll miss the WM_QUIT message to demonstrate why that's a bad idea.
The WM_QUIT message is generated, but because you are only removing the messages for your window using GetMessage when you pass it your window's handle, the message pump while-loop never exits. (system messages have a hwnd value of NULL.)
So even though the window has gone, the app will still be running; but invisible -- it will be listed in Task Manager's "Process" list, though.
Andy
PS I think the book you're currently reading ("Beginning Visual C++" by Ivor Horton?) is possibly a bit confusing as a first book on Windows programming?
I think you should maybe look at "Programming-Windows" (by Charles Petzold), the book most people use to learn Win32 programming. http://www.charlespetzold.com/pw5/
Yes! Petzold's Book is awesome I read it few times. Although it does not teach advanced Windows Programming Concepts but it is still useful in sense majority of Needed items are included in it.