如何防止任务管理器结束我的申请流程? [英] How can I prevent my application process being ended by task manager?
问题描述
我有一个cafemanager应用服务器和客户端。我想阻止用户从任务管理器结束我的客户端应用程序,因为服务器应用程序在关闭时无法再与工作站通信。像防病毒一样说访问被拒绝了。我不想禁用任务管理器,因为它在游戏崩溃时很有用..
I have a cafemanager application server & client. I want to prevent my client application to be ended from task manager by users because the server application can no longer communicate to the workstation when it closes. Like antiviruses did saying access denied. I dont want to disable task manager because it is helpful when games crashes..
推荐答案
Hi Weecom,
如果可以,我建议你从任务管理器隐藏你的应用程序。
然后用户如何从任务管理器结束你的应用程序。
您可以参考此链接获取same [< a href =http://www.vbforums.com/showthread.php?648668-RESOLVED-Hide-from-Applications-in-task-manager-but-not-in-Processess&p=4003014#post4003014target = _blanktitle =新窗口> ^ ]。
希望这对你有所帮助。
问候,
RK
Hi Weecom,
I would suggest you to hide your application from the task manager if you could.
Then how user can end the your application from Task manager.
You could refer this link for the same[^].
Hope this helps you a bit.
Regards,
RK
Hi Weecom
使用此代码你可以检查你的主要表格(event me.FormClosing)谁试图关闭你的申请:
Hi Weecom
With this code you can check in your main form (event me.FormClosing) who try to close your application:
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Select Case e.CloseReason
Case CloseReason.ApplicationExitCall
MsgBox("'ApplicationExitCall' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.FormOwnerClosing
MsgBox("'FormOwnerClosing' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.MdiFormClosing
MsgBox("'MdiFormClosing' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.TaskManagerClosing
e.Cancel = True
MsgBox("'TaskManagerClosing' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.UserClosing
MsgBox("'UserClosing' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.WindowsShutDown
MsgBox("'WindowsShutDown' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case CloseReason.None
MsgBox("'None' tries to close application", MsgBoxStyle.Information, "CloseReason")
Case Else
MsgBox("'Else' tries to close application", MsgBoxStyle.Information, "CloseReason")
End Select
End Sub
e.Cancel = True您可以避免第一次尝试通过任务管理器或其他CloseReasons中止应用程序/>
希望这可以帮到你。
问候马库斯
with e.Cancel = True you can avoid the first try to abort the application by Task Manager or other CloseReasons
Hope this can help you.
Regards Markus
这篇关于如何防止任务管理器结束我的申请流程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!