gpt4 book ai didi

c# - 密码保护 Winforms 应用程序

转载 作者:行者123 更新时间:2023-11-30 18:46:10 24 4
gpt4 key购买 nike

我有一个在系统托盘中运行的简单 WinForms 应用程序。如果用户试图从任务管理器关闭程序,是否可以使用密码保护程序不被关闭?

理想情况下,我希望阻止用户关闭该进程,但如果 Windows 重新启动,我希望它在没有提示的情况下关闭。很像防病毒程序。

最佳答案

如果用户拥有正确的权限,他们将能够从任务管理器中终止您的进程。

正如@fujiFX 在他的评论中提到的那样 FormClosing事件是一个好的开始,聊胜于无。

The FormClosing event occurs as the form is being closed. When a form is closed, it is disposed, releasing all resources associated with the form. If you cancel this event, the form remains opened. To cancel the closure of a form, set the Cancel property of the FormClosingEventArgs passed to your event handler to true.

关于c# - 密码保护 Winforms 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30744246/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com