mfc doesnot close  
Author Message
KZG





PostPosted: Visual C++ Language, mfc doesnot close Top

Hi good people,
I created a dialog based mfc application with standard OK button (ID = IDOK). Wenn I close the window, either with the OK button or with the "X" button, the dialog closes, but with the task manager I can see the application is still running. What do I have to do to close it right

Thanks for every help!
KZG




Visual C++11  
 
 
Damien Watkins - MSFT





PostPosted: Visual C++ Language, mfc doesnot close Top

Hello

Re: mfc doesnot close

The more appropriate place for your question is probably the MFC newsgroup: http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.vc.mfc&lang=en&cr=US

OTP

Thanks

Damien



 
 
KZG





PostPosted: Visual C++ Language, mfc doesnot close Top

ok I'll try there.
thx

 
 
Bapa





PostPosted: Visual C++ Language, mfc doesnot close Top

I'm aware that this is the innapropriate place, but blah.

I believe you have to call "PostQuitMessage(0);" when you want the program to terminate. Otherwise, you kill the window, but not the process itself :|


 
 
Simple Samples





PostPosted: Visual C++ Language, mfc doesnot close Top

I'm aware that this is the innapropriate place, but blah.

I believe you have to call "PostQuitMessage(0);" when you want the program to terminate. Otherwise, you kill the window, but not the process itself :|

One of the best reasons to ask in an appropriate forum or newsgroup is that it is usually beneficial for the person asking the question, since the majority of people answering questions would be experienced with the relevant software and intend to help with it.

The advice to use PostQuitMessage is an excellent example of why it is a mistake to get help here. Unless a person is very experienced with MFC and understands what they are doing, it is most likely a mistake to call PostQuitMessage directly in a MFC program without allowing MFC to do all of it's termination and such. Data might not be written as expected. All processing done for closing a window would not be done.



 
 
Simple Samples





PostPosted: Visual C++ Language, mfc doesnot close Top

Create a new MFC dialog-based project. Immediately after creating the project, build it. Test it; verify that it works as expected. Then copy the code as needed from the old project to the new project.