From my C# application, I'm trying to get notification from another (specific) application when it is closing (just when its process ends). From what I found, hook on this process is a possible solution, but I didn't managed to make it work. Can anyone help me on that or propose another solution.
You can use the Process class to do this, specifically, its Exited event:
var process = Process.GetProcessesByName("notepad").Single();
// or Process.GetProcessById() if you have the ID
process.EnableRaisingEvents = true;
process.Exited += YourHandler;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With