如何检测终止进程事件 [英] How to detect a Kill Process event
本文介绍了如何检测终止进程事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在C#中,我使用process.Kill()杀死一个进程, 同时在被杀死的应用程序中如何检测到此事件?
In C# i using process.Kill() kill a process, at the same time in killed application how to detect this event?
顺便说一句:Application.ApplicationExit事件尚未触发!
BTW: Application.ApplicationExit event has not been fired!
推荐答案
如果它是Winform,则可以捕获事件FormClosing
并检查CloseReason
:
if it's a winform, you can capture the event FormClosing
and check the CloseReason
:
None
WindowsShutDown
MdiFormClosing
UserClosing
TaskManagerClosing
FormOwnerClosing
ApplicationExitCall
这篇关于如何检测终止进程事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文