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 Windows 7 task manager did when you clicked on "End Task"? (and not "End Process")
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…