Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Closing an application safely

Hiya

I am doing some checks in the InitInstance of an SDI application. If certain conditions are not met e.g. certain files to be loaded, cannot be found the application needs to shut down. I have done this by using exit(0) whenever I need to close the application.

This works but I tend to get memory leaks and, when I'm using the debugger to check the code, the application closes but it still appears to be in memory in Visual Studio so I have to use Stop Debugging to close it down (even though the application doesn't appear on-screen).

Can anybody give me advice on how to close an SDI application without having these problems?

John
0
IssacJones
Asked:
IssacJones
1 Solution
 
AndyAinscowCommented:
AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0);
0
 
IssacJonesAuthor Commented:
Cheers Andy!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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