1
我想通过单击C#Windows窗体应用程序中的按钮来休眠我的计算机。从C#休眠计算机#
private void Button1_Click(object sender, EventArgs e)
{
//Hibernate the computer
}
我想通过单击C#Windows窗体应用程序中的按钮来休眠我的计算机。从C#休眠计算机#
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");
请参阅Application.SetSuspendState()
方法获取更多信息。
你可以这样调用它
Application.SetSuspendState(PowerState.Hibernate, true, true)