why is my program stayin in memory??????????

Started by
6 comments, last by Merc22 23 years, 1 month ago
i compiled my win32 program and exited it as usual i pressed alt-ctrl-del and found that the program was still lingering there wat can i do so that it doesnt stay there and freeze? thanx
Advertisement
Usually, that doesn''t happen. Tell us more about the program.
Make the program show a MessageBox just before the exit. Perhaps it doesnt reach the exit point at all.
Restart your computer. Windows does strange stuff at times.
i did put a message box
i checked the code over but i cant find anything that would keep it from going away

im gonna try restarting my computer
I guess you''re missing the PostQuitMessage(0) in your WM_DESTROY.

ummm

i dont have a WM_DESDTROY in my message handler

do i have to have one?
i never used it before
ummm

i dont have a WM_DESTROY in my message handler

do i have to have one?
i never used it before
No, you don''t need one, you can use WM_CLOSE instead, but you need PostQuitMessage in the program regardless.
Ok i think i might know where the problem is since the same thing used to happen to me.

If you have a main loop in your app that looks something like this:

while (Running)
{
...
DoStuff();
RenderStuff();
...
}

What happens is, if you call PostQuitMessage(0)when quiting, the window is destoyed but the main loop will still be running in the background (explaining why it is still there when you press alt+ctrl+del). So make sure whenever you want to quit, first break out of your main loop (eg by saying Running=false), and then use the PostQuitMessage(0)

Hope that helps

This topic is closed to new replies.

Advertisement