Process Progress using C#

How can we tell that a process; which was not started by my program but by windows; is completed

Thanks.

P.S.: Let me know if I need to explain it a little more. Thanks.



Answer this question

Process Progress using C#

  • BradN

    The hard part of this question is getting a System.Diagnostics.Process handle to the process.

    But once you've got that, it's easy: you can either use Process.WaitForExit(), or Process.HasExited.

    Be warned if the process is known to return the exit code 259 (0x103), however, because that number also means it is still active (in the Win32 world). .NET does perform extra steps to see if 259 means it exited with 259 or is still active, but I wouldn't trust it.

    This only tells you if the process has exited or not. In general, it is not possible to determine how much progress (eg. if it's 25% completed, or 50% completed) the process has made.



  • Process Progress using C#