Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Alternate to PostQuitMessage

Hi all,

For some strange reason the ::PostQuitMessage(0); does not always work if my software has been open for a while.... Is there another way to close the app.  I don't want to use ExitProccess as I'm cleaning up on the Applications deconstructor.

Thanks
Aaron
0
almorris
Asked:
almorris
3 Solutions
 
bcsonkaCommented:
Hi,

Give one of these a shot . . .

EndDialog(0);  // If main window is dervied from CDialog

or

::DestroyWindow(AfxGetMainWnd()->m_hWnd);  // If main window is dervied from something other than CDialog

I hope that helps.
0
 
migoEXCommented:
ExitProcess should be fine, as all the clean-up operations are still performed. This is opposite to TerminateProcess, when none of the DLLs is notified, and the process is shut down immediately.
0
 
itsmeandnobodyelseCommented:
You could try

    ::PostMessage(AfxGetMainWnd()->m_hWnd, WM_QUIT, 0, 0);

anywhere in your program.

Regards, Alex

0
 
bcsonkaCommented:
I feel I gave two pretty good alternatives to PostQuitMessage
0
 
almorrisAuthor Commented:
Sorry, I've been outa town.  

I finally figured out that it was another thread that was causing the problem.  
I'm happy to divy up the points for everyone's input.

Thanks
Aaron
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now