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?