我想通过单击 C# Windows 窗体应用程序中的按钮让我的计算机休眠。
private void Button1_Click(object sender, EventArgs e)
{
//Hibernate the computer
}
最佳答案
使用Application.SetSuspendState
方法:
private void button1_Click(object sender, EventArgs e)
{
Application.SetSuspendState(PowerState.Hibernate, true, true);
}
或者:
using System.Diagnostics;
Process.Start("shutdown", "/h /f");
关于c# - 从 C# 休眠计算机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37764445/