I want to terminate a number of processes, but I want to give each process the chance to save its data, ask the user about saving a file and even ignore the close request.
So TerminateProcess
is out of the question, because it kills the process instantly. Another way would be to use SendMessage
/PostMessage
to send a WM_CLOSE
to the main window, unfortunately I don't know anything about the windows of the processes, I only have the process id, so FindWindow
doesn't help either. Is there any other way to find the main windows of a process?
In other words: Is there any way to terminate any process gracefully just like the task manager does when you click on "End Task"? (and not "End Process")