Skip to main content
GameDev.net gamedev.net
🔒 Locked

Program won't exit

Started by Dustino Jan 8, 2002 at 2:49 PM 9 replies 1.4k views
Original Post
Dustino
Dustino
The program I am working on will not close. When I close it the window will close and it will leave the taskbar, but if I look in the Close Program window the program will still be there. And I know the program is still open because if I try to compile it again it says it can''t write to the exe. So to close it I have to close it through the Close Program window. Any help would be greatly appreciated.
Dustino
Dustino
I already am.

case WM_CLOSE:
{
OA_Shutdown();

wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);

PostQuitMessage(0);
} break;
hewhay
hewhay
If your program is a windows program try adding to your WNDPROC
  
case WM_CLOSE:
PostQuitMessage (0); // or PostMessage (hWnd, WM_QUIT, 0, 0);

return 0;



If its a MFC program a description of your message handlers would help
humanity will always be slaved by its ignorance
Dustino
Dustino
I have the following in WinMain()

while (!done)
{
PeekMessage(&msg, hWnd, NULL, NULL, PM_REMOVE);

if (msg.message == WM_QUIT)
{
done = true;
}
else
{
OA_RenderScene();

SwapBuffers(g_HDC);
TranslateMessage(&msg);
DispatchMessage(&msg);
}
guitarman310
guitarman310
try
  
case WM_QUIT:
case WM_CLOSE:
PostQuitMessage(0);
return 0;

case WM_MOUSEMOVE: // ...etc

[source]#define JESUS 1[/source]
BliGH
BliGH
Yes put the PostQuitMessage() in the WM_DESTROY().
For the WM_CLOSE I found that sometimes I would get an empty box on my taskbar when I used DestroyWindow(), so I switched to:

PostMessage( window, WM_DESTROY, (WPARAM)0, (LPARAM)0);

and it seemed to clear it up. Strange because it seems to do the exact same thing?
Dustino
Dustino
Okay I got it working. Thanks for all of your help.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.