As far as I know the GetMessage() function returns zero if it receives a WM_QUIT message. This is often used as a way to stop the message loop and terminate the program. Since I like to play around with my code to see the actual effects of API functions and how they could be used I tried to remove my PostQuitMessage() function just to see if the program remains in memory after the main window is destroyed. I noticed it quits completely, and I want to know why just for the sake of knowing
I really appreciate all help I can get.
Here is my message loop
and here's my WndProcCode:while(GetMessage(&msg, WndPtr, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); }
Code:LRESULT CALLBACK msg_control(HWND WndPtr, unsigned int msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_CLOSE) { DestroyWindow(WndPtr); } else if(msg == WM_DESTROY) { //PostQuitMessage(0); } else { return DefWindowProc(WndPtr, msg, wParam, lParam); } return 0; }



LinkBack URL
About LinkBacks





