Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

bkt

Window not closing properly

This topic is 5224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
I can''t just exit the process, it''s not that simple. But I will try exiting through the normal means.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!