I thought I'd share a quick tidbit of knowledge that just caused me a few minutes of frustration. The EnableRaisingEvents property must be set to true before the Exited event will be fired.
Process p = new Process();
p.StartInfo = new StartInfo();
p.StartInfo.FileName = "myExecutable.exe";
//required to receive exited event
p.EnabledRaisingEvents = true;
p.Exited += ProcessExited;
p.StartInfo = new StartInfo();
p.StartInfo.FileName = "myExecutable.exe";
//required to receive exited event
p.EnabledRaisingEvents = true;
p.Exited += ProcessExited;
04/08/2010 - 18:09
Wow, thanks! I solved the problem in 1 minute after finding this with a google search. :-D
--Aaron
05/27/2010 - 22:34
For some reason, in Windows 7, when I use the taskbar to close some applications, the exited event does not fire. If I close the same application via the red window close button, then the event fires.
Any ideas?
09/21/2010 - 06:53
Thanks a lot. This came in real handy
Add Comment
[language] [/language]
Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]
See here for supported languages.
Javascript must be enabled to submit anonymous comments - or you can login.