Jump to content
  • Advertisement
Sign in to follow this  
FunkGnome

Having problems with a window not closing properly...

This topic is 5394 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

There's nothing too complicated about it, I recently decided to start a new framework from scratch, given that I've learned a lot of new tricks in the past few months. But on to the problem at hand... Right now, all I've got is a Win32 program that makes a window with the usual flavors (maximize, minimize, close, etc). While running, it behaves like it should, using very little memory and very few cycles, since it's not doing anything but waiting. When I close the window, the program appears to quit, but a quick task manager check reveals that it's still running as a service, and eating up as many cycles as it can. This kind of behavior is pretty alien to me, and I haven't been able to nail it down for a few days now. I've unregistered the window class, and nullified both the window's handle and the program's instance. Yet the problem persists... I wish I had some code to show you, but I'm at work at the moment, and looking for similar experiences. If needed, I'll post it later. I'm running WinXP, writing C++ using VC++ 6.0.

Share this post


Link to post
Share on other sites
Advertisement
It sounds like your message loop hasnt exited.
Check to ensure that you are breaking from the message loop when you want the program to exit.

Share this post


Link to post
Share on other sites
The problem is usually that the window handle was passed to the message pump (GetMessage or PeekMessage), while the WM_QUIT message is not sent to any particular window. One way to handle this is to pass NULL as the HWND parameter, causing the message to be handled by the window procedure. The other option is to explicitly check the value of the message field of the MSG structure.

Share this post


Link to post
Share on other sites
Remember, a window isn't a program. You probably didn't exit the message pump loop when the window was destroyed.

Share this post


Link to post
Share on other sites
When something is spinning, you can use the Attach function of MSDN (if you aren't already debugging), and Break All to stop "anywhere". Then switch to a thread that you're interested in, and use shift-F11 ("step out") until you're at a point where you can get a stack trace, and figure out what's happening. (Set breakpoints, look at variables, etc)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!