Here's what I'm doing. I have a loop that fires 20 processes using Process.Start(). I want them all to fire at once, however I want to catch them as they close. Is there anyway to do this in C#?
I know you can do process.WaitForExit(), but then all of them don't fire at once (which is what I want it to do). Basically, I want to know when certain processes end so I can inform the user by updating database records, so they can know when certain processes have finished. As opposed to just trying to keep track of them as they close and changing the ProcessWindowStyle to normal.
Many thanks.
Set Process.EnableRaisingEvents
to true, and subscribe to the Exited
event.
An alternative is to have a timer on which you check the HasExited
property.
You can listen to the Exited event (you have to make sure EnableRaisingEvents is true).
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