madshi,
What is the difference between IsValid, IsStillValid and IsRunning. If I launch notepad.exe the line Process('notepad.exe').IsStillValid, IsValid and IsStillRunning all return TRUE. Is there a situation where one is better to use than another?
Thanks,
SteveO
Confused about Process.IsValid, IsStillValid, IsRunning
"IsValid" indicates whether the process was valid at the time when the interface got created. IsStillValid and IsStillRunning both return whether the process is still running. However, those two methods work slightly differently internally. IsStillValid enumerates all processes to see whether your process is still in the list of running processes. IsStillRunning uses WaitForSingleObject to see whether the process handle still indicates that your process is still running. But honestly there's no difference in practise. I'd say use IsStillRunning, cause that might be faster.