|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Determine If a Process Has Exited
You can use theproperty to determine if the process associated to a component has stopped running. The property value returns true if the process is closed and false if the process is still running.
This value is only returned for processes that are started by a Process component.
The Process component does not need to close the associated process to obtain the HasExited property. Administrative information such as the HasExited andproperties are stored regardless of the way the associated process was closed. The information is stored even if the user closes the process by selecting the Close command in its interface. This information is useful if you want to make sure all processes started with your Process components close when you exit an application.
To determine if a process has exited
Read the HasExited property of the Process component that was used to open the process.
The following example shows how to use the HasExited property to determine if the process associated with a Process component called Process1 has been closed. If it is open, callto close the application.