How can I prevent a user from closing my C# application?

前端 未结 4 1879
陌清茗
陌清茗 2020-11-30 08:27

How to make unclosed application in C#? I want to disable the \'X\' button of the form and prevent the Windows Task Manager from closing it as well.

I know that one

4条回答
  •  臣服心动
    2020-11-30 08:59

    It is not that hard to protect a process from beeing killed by regular users. An application can modify it's own process ACL preventing ANY taskmanager to kill it. They will simply get an "Access denied!" when trying to kill the process.

    You should, however, allways allow administrators to be able to kill the process so it wont interfere with a system shutdown or other administrative tasks.

    I could provide you with code, if still nescessary.

提交回复
热议问题