进程退出的问题 [英] Issue with Process Exited

查看:98
本文介绍了进程退出的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我说我有一个ID为1234的进程.该进程在我的应用程序运行之前就已运行.

lets say I have a process with the ID 1234. This process is running before my application runs.

我有此代码:

        Process app = Process.GetProcessById(1234);
        MessageBox.Show(app.MainWindowTitle);
        app.Exited += this.methodShowsMessageBox;

现在,当我编译并运行该应用程序时,它将获取该过程并显示主窗口标题.但是当我关闭进程1234时,app.Exited不会触发...这是为什么?而我该如何射击呢?

Now, when I compile and run the app, it gets the process and shows the main window title. However when i close process 1234, the app.Exited does nto fire... why is this? And how would i get it to fire?

推荐答案

请注意,

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

这篇关于进程退出的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆