阻止任务管理器关闭应用程序 [英] Prevent app from closing by Task Manager

查看:82
本文介绍了阻止任务管理器关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在编写一个供个人使用的应用程序,这是一个自动系统关闭应用程序。


它将会以两种方式工作,从现在开始设置一段时间,或者设置将来关机的时间。


对我来说使用是至关重要的,但是当我用Google搜索时,VB.NET会阻止应用关闭通过任务管理器我找到了令人失望的答案!


首先,我知道它应该需要一些Win32编码,并且没有原生的VB.NET 2017 .NET FW 4.0可以做到这一点。


但是对这个问题的大多数回答是:你想用这段代码做什么?


这可以用于恶意软件!或类似的东西!


审查信息和知识以防止以不好的方式使用它是愚蠢的!谁在VB.NET中写了这么邪恶的应用程序?


我们也不是法官!判决其他人!如果您不知道答案,或者根本不想给出答案,请忽略该帖子。我正在使用VB.NET 2017 - .NET FW 4.0。


在我之后使用我的电脑的朋友不应该关闭我的应用程序,我发现这段代码根本不起作用:

 Private Sub MainForm_FormClosing( sender As Object,e As System.Windows.Forms.FormClosingEventArgs)处理Me.FormClosing 

如果e.CloseReason = CloseReason.TaskManagerClosing那么
e.Cancel = True
MessageBox。显示("任务管理器试图关闭我")
结束如果

结束子




另外,在任务管理器列表中隐藏应用程序名称也行。


我发现我也是无法通过任务管理器关闭我的McAfee流程,所以它不应该那么糟糕!

解决方案

你好OSVBNET,


欢迎来到MSDN论坛。


请参阅您的描述,您的问题是关于VB的开发。由于我们的论坛是讨论VS IDE,我将帮助您将此线程移至相应的论坛:
Visual
Studio语言
 > 
Visual Basic
寻求更专业的支持,谢谢你的理解。





最好的问候,


萨拉


Hi,

I am writing an application for my personal use, which is an Auto system shutdown app.

It will work in 2 ways, set some time from now, or set a time to shutdown in the future.

Usage for me is vital, however when I Googled VB.NET prevent app from being closed by Task Manager I found disappointing answers!

1st of all, I know it should need some Win32 coding, and no native VB.NET 2017 .NET FW 4.0 can do this.

But most of the responses to this question was : What are you trying to do with this code snippet?

This can be used for malware! or something similar!

Censoring information and knowledge to prevent use it in a bad way is silly! Who writes such an evil application in VB.NET?

Also we are not Judge ! To verdict the others ! If you don't know the answer, or simply don't want to give the response, please disregard the thread.I'm using VB.NET 2017 - .NET FW 4.0.

My application should not be closed by my friends who use my PC after me, I found that this code DOES NOT WORK at all:

Private Sub MainForm_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

If e.CloseReason = CloseReason.TaskManagerClosing Then
    e.Cancel = True
    MessageBox.Show("Task manager tried to close me")
End If

End Sub


Also, make the application name hidden from Task Manager list is also OK.

I found that I also cannot close my McAfee process via Task Manager, so it should not be that bad!

解决方案

Hi OSVBNET,

Welcome to the MSDN forum.

Refer to your description, your issue is about the VB development. Since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum: Visual Studio Languages  >  Visual Basic to seek for a more professional support, thank you for your understanding.

Best regards,

Sara


这篇关于阻止任务管理器关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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