Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从C休眠计算机#_C#_Windows_Winforms - Fatal编程技术网

C# 从C休眠计算机#

C# 从C休眠计算机#,c#,windows,winforms,C#,Windows,Winforms,我想通过点击C#Windows窗体应用程序中的按钮来休眠我的计算机 private void Button1_Click(object sender, EventArgs e) { //Hibernate the computer } 有关更多信息,请参阅方法 你可以这样称呼它 Application.SetSuspendState(PowerState.Hibernate, true, true) 使用方法: 或: private void button1_Click(object

我想通过点击C#Windows窗体应用程序中的按钮来休眠我的计算机

private void Button1_Click(object sender, EventArgs e)
{
    //Hibernate the computer
}
有关更多信息,请参阅方法

你可以这样称呼它

Application.SetSuspendState(PowerState.Hibernate, true, true)
使用方法:

或:

private void button1_Click(object sender, EventArgs e)
{
    Application.SetSuspendState(PowerState.Hibernate, true, true);
}
using System.Diagnostics;
Process.Start("shutdown", "/h /f");