Program won't exit
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.
I already am.
case WM_CLOSE:
{
OA_Shutdown();
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
PostQuitMessage(0);
} break;
case WM_CLOSE:
{
OA_Shutdown();
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
PostQuitMessage(0);
} break;
If your program is a windows program try adding to your WNDPROC
If its a MFC program a description of your message handlers would help
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
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);
}
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);
}
Have you set a breakpoint on the line done=true; and see if it hits it? Then try to follow from there?
Or, better yet, set a breakpoint or trace (OutputDebugString) in your WM_CLOSE block and see if that is being reached.
try
case WM_QUIT:case WM_CLOSE: PostQuitMessage(0); return 0;case WM_MOUSEMOVE: // ...etc
no..no..no..
I think I am losing my mind sometimes..
In WM_CLOSE call DestroyWindow(hwnd); Then in response to WM_DESTROY call PostQuitMessage(0);
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?
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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement