简体   繁体   English

如何防止Windows使用C#关闭?

[英]how to prevent windows from shutting down using c#?

I am making a desktop application using c# in which i have to prevent the computer from shutting down in some conditions. 我正在使用c#制作桌面应用程序,其中必须防止某些情况下计算机关闭。

 Microsoft.VisualBasic.Interaction.Shell("shutdown -a", AppWinStyle.MinimizedFocus, false, -1);

this command is not running in my visual studio 2012. Try to give a better solution. 我的Visual Studio 2012中未运行此命令。请尝试提供更好的解决方案。 Thankyou 谢谢

Try this: Prevent shutdown c# 试试这个: 防止关机c#

Else do => 否则=>

  • Create Application.ApplicationExit Event and execute ('shutdown -a') 创建Application.ApplicationExit事件并执行(“ shutdown -a”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM