Hear Ye, Hear Ye
Hello, I am programming windows and OpenGL with C++ and Visual Studio 6.0, and when I close my program the window will go away,however the .exe will stay in the memory, so If I go to link it again I get in error saying it cant open the file for writing. The only way I can close my program is by hitting
ctrl-alt-del and closing my program from there. Any ideas?
"You can observe a lot just by watching."- Yogi Berra
If you''re using MFC, this shouldn''t happen. If however you are using straight Win32 API calls, you''re probably not posting the WM_QUIT message when you''re window closes. You need to call PostQuitMessage(), and make sure you break out of your message loop when you get WM_QUIT. Hope this helps.
If you''re using MFC, this shouldn''t happen. If, however, you are using straight Win32 API calls, you''re probably not posting the WM_QUIT message when your window closes. You need to call PostQuitMessage(), and make sure you break out of your message loop when you get WM_QUIT. Hope this helps.
I'm using straight Win32 API calls, and I PostQuitMessage(0) when I get WM_CLOSE, is that the right place to put it? I also shutdown my window there and that works fine. I also checked my loop and that exits when it should.
"You can observe a lot just by watching."- Yogi Berra
Edited by - clrscr on December 11, 2001 8:01:45 PM
Edited by - clrscr on December 11, 2001 8:02:00 PM
"You can observe a lot just by watching."- Yogi Berra
Edited by - clrscr on December 11, 2001 8:01:45 PM
Edited by - clrscr on December 11, 2001 8:02:00 PM
I get the same problem a lot of the time, and here is my solution:
I hope this helps...
---------------
I finally got it all together...
...and then forgot where I put it.
BOOL bQuit = FALSE; while (!bQuit) { if (PeekMessage(&msg,NULL,0,0,PM_NOREMOVE)) { if (GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { bQuit = TRUE; } } DoStuff(); }
I hope this helps...
---------------
I finally got it all together...
...and then forgot where I put it.
...and, in the message receiver thingy:
---------------
I finally got it all together...
...and then forgot where I put it.
case WM_DESTROY:PostQuitMessage(0);break;
---------------
I finally got it all together...
...and then forgot where I put it.
That fixed it, thanks a lot for the help
"You can observe a lot just by watching."- Yogi Berra
"You can observe a lot just by watching."- Yogi Berra
Correction. You should be calling DestroyWindow() when you get WM_CLOSE and then calling PostQuitMessage() when you get WM_DESTROY.
quote:Correction. You should be calling DestroyWindow() when you get WM_CLOSE and then calling PostQuitMessage() when you get WM_DESTROY.
Maybe, maybe...but it works anyway... Windows working behind my back again?
---------------
I finally got it all together...
...and then forgot where I put it.
Oh, strtok, I use DefWindowProc if i don''t catch the msg - that must be thuh reason
---------------
I finally got it all together...
...and then forgot where I put it.
---------------
I finally got it all together...
...and then forgot where I put it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement