The trouble is:
PostQuiteMessage
does not work in all situations. It posts
WM_QUITE
, so you should assume that all conditions work the way that it would lead to application termination eventually: the message loop is being still executed, messages are being processed, and so on. Please see:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644945%28v=vs.85%29.aspx[
^].
This is probably not the case. As you did not provide any information on the state of your process, I have no idea what is it. It could be anything, really.
The hard way of terminating the process (yes, you can terminate your current process) is this:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179%28v=vs.85%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.85%29.aspx[
^].
Better avoid doing it by all means.
Many would say that the idea to kill the current process in this way is abusive. And I will agree with this opinion. I will only add that the whole idea to terminate the current process (even nicely) and start another instance of the same application
is itself a pretty strong indication of technology abuse. If you need more help, you will need to
explain some motivation of what you are doing, and your ultimate goals. Chances are, you will be suggested more reasonable alternative.
—SA