如何找到我的应用程序是否被taskmanger终止 [英] how can find if my application is terminated by taskmanger

查看:61
本文介绍了如何找到我的应用程序是否被taskmanger终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了下面的代码,但是我找不到我的应用是否被taskmanager终止

i have tried below code but i cant find if my app is terminated by taskmanager

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
            messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason);
            messageBoxCS.AppendLine();
            messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel);
            messageBoxCS.AppendLine();
            MessageBox.Show(messageBoxCS.ToString(), "FormClosing Event");

推荐答案

当应用程序窗口即将关闭甚至已经关闭时,您的应用程序尚未终止,因此可以执行某些操作.如果终止,则为 为时已晚 .在此代码中,您不会运行任何可检测到该代码已终止的代码. :-)

—SA
When an application windows is about to be closed and even already closed, your application is not terminated yet, so it can perform some action. If it is terminated, it''s too late. At this code, you don''t any code running to detect the code is terminated. :-)

—SA


这篇关于如何找到我的应用程序是否被taskmanger终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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