I know that it is possible to close an application by calling the exit(0)
function. And that by using it, all heap-allocated memory prior to the call is cleared. So you do not have to worry about it.
But to debug your program and investigate better if there is a memory leak, it is not practical to close the program without first releasing all memory.
So I wanted to schedule the closure by adding the same message that the system sends by pressing the X button on a window (WM_CLOSE
).
With that message(or event), the program can execute the code that will close the application.
So the question is if there is any function, or something from the winapi that adds that message to the current process?