Issue with Process Exited

拜拜、爱过 提交于 2019-12-05 03:23:26

Please note that the documentation states that EnableRaisingEvents must be set to true before this event will fire.

By default, for performance reasons, the Process class does not raise events. If you want the Process object to watch for Exited and raise that event, you need to set its EnableRaisingEvents property to true.

There is a cost associated with watching for a process to exit. If EnableRaisingEvents is true, the Exited event is raised when the associated process terminates. The procedures that you have specified for the Exited event run at that time.

Sometimes, your application starts a process but does not need to be notified of its closure. For example, your application can start Notepad to allow the user to perform text editing, but make no further use of the Notepad application. You can choose to not be notified when the process exits, because it is not relevant to the continued operation of your application. Setting EnableRaisingEvents to false saves system resources.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!