Original Post
Gurus,
I have noticed that if I write my Main Window Loop as follows, closing the window does not kill the process. The process continues to run and consume 100% of the CPU resources.
while(true)
{
if(PeekMessage(&msg,hWnd,NULL,NULL,PM_REMOVE))
{
if(msg.message == WM_QUIT)
break;
else
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
I have discovered that if I change the Message Loop to this, the program functions as expected. Closing the window also kills the process.
while (GetMessage(&msg, NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
I have seen game programming books use the first method. I have *heard* GetMessage is too slow for game programming. Can anyone see anything I am doing wrong in the first code snippet?
CHris