Reputation: 13316
I'm trying to run some code when notepad.exe has been closed gracefully (by the user, as opposed to crashed or shutdown by the OS) using Win32 events so I can implement an autosave.
If I have an IntPtr
for a running notepad.exe process handle, how can I do this?
Upvotes: 0
Views: 492
Reputation: 101764
There is no process property you can query to see if a process crashed or was terminated. The best you can do is to check the exit code, if it is 0 then the process probably exited after successfully completing its "action".
MSDN has a example that uses WaitForExit
and the ExitCode
property on a child process...
Upvotes: 1