Window not closing properly

Started by
1 comment, last by bkt 19 years, 10 months ago
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!
-John "bKT" Bellone [homepage] [[email=j.bellone@flipsidesoftware.com]email[/email]]
Advertisement
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;				}			}                        case WM_QUIT:                                exitTheProcessSomehowProbablyByReturningSomeValueFromYourMainFunction ();			break;		}                       	}}




[edited by - Oxyd on June 5, 2004 10:02:28 AM]
I can''t just exit the process, it''s not that simple. But I will try exiting through the normal means.
-John "bKT" Bellone [homepage] [[email=j.bellone@flipsidesoftware.com]email[/email]]

This topic is closed to new replies.

Advertisement