I don’t know if this question was already asked, but I could not find anything on it, so please lead me in the right direction if you can find something.
Basically, I would like to add an event to my current C# program to be raised when another specified process (“example.exe”) exits. Is that possible?
If that is not possible, is there, instead, a way to raise an event when a specified process by direct path (“C:\somefolderpaths…\example.exe”) exits?
To add: My program does NOT start the process example.exe.
If you are using C# 4.0 you can do something like:
EDIT
If you are not creator of a process, you can use Process.GetProcessesByName function to retrive the process from already available ones.
In this way you can avoid blocking your main thread, and run the code you need at the moment external process exited. Meanwhile, continue do something more important.