防止C#桌面应用程序被Task Mananger关闭 [英] Prevent C# desktop Application from closing by Task Mananger

查看:212
本文介绍了防止C#桌面应用程序被Task Mananger关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了 Application.ApplicationExit 事件处理程序。当我结束任务时,它只关闭应用程序并且根本不会触发事件处理程序。我想抓住这个时间,因为它对休息管理非常重要。目的是跟踪关闭应用程序的确切时间。

解决方案

它可能会让您感到惊讶,但客户端的计算机属于客户端!那么你想在什么基础上阻止他杀死你的应用程序?!

对于我们的业务 - 如果这个过程被粗暴地杀死,没有任何事件可以保证被调用 - 原因是事件链在你的进程内部,但是kill请求来自外部,并且不会等到你的进程直到响应,但会在预定义的时间范围内杀死它...


进行服务检查如果应用程序正在运行,如果它没有运行启动服务中的应用程序


它不可能,也不要尝试这个

bcose它不合逻辑

I have tried the Application.ApplicationExit event handler. When i end task the process it just closes the application and the event handler is not triggered at all. I want to catch this time since its important for break management. The purpose is to track exact time of closing the application.

解决方案

It may surprise you but client's computer belongs to the client! So on what base do you want to prevent him to kill your app?!
To our business - there is no event that guaranteed to be called if the process killed rudely - the reason is that the event chain is inner to your process, but the kill request comes from the outside and will not wait for your process until response but will kill it within predefined time-frame...


make a service check if application is running if its not running start the application in the service


its not possible and dont try this also
bcose its not a logical thing


这篇关于防止C#桌面应用程序被Task Mananger关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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