I''ve had this problem seemingly for awhile now (I once fixed it, but I can''t remember how I did it). I have ESCAPE bound to exit my game, but if I run it in windowed mode, hitting the "X" will close the window but not the process. As I said before, I''ve had this problem before but I can''t remember how I fixed it.
Here''s my WndProc code; and the message loop:
WndProc
//j: windows process handling
LRESULT WINAPI Platform::WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) {
switch(msg) {
case WM_CREATE:
return 0;
case WM_DESTROY:
KERNEL.Shutdown( );
PostQuitMessage(0);
return 0;
case WM_PAINT:
ValidateRect(hWnd,NULL);
return 0;
}
return DefWindowProc(hWnd,msg,wParam,lParam);
}
Message Loop
void Platform::Update(void) {
MSG msg;
if(PeekMessage(&msg,0,0,0,PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
switch(msg.message) {
case WM_KEYDOWN: {
switch(msg.wParam) {
case VK_ESCAPE:
KERNEL.Shutdown( );
break;
}
}
break;
}
}
}
-
John "bkt" Bellone
Flipside Software
FlipEngine!