window下命令
powercfg /change "Home/Office Desk" /moniter-timeout-ac 1
C#中实现
[DllImportAttribute("user32.dll")]
SendMessage(IntPtr hWnd, uint msg, uint wParam, int lParam)
private const uint WM_SYSCOMMAND = 0x0112;
private const uint SC_MONITORPOWER = 0xF170;
SendMessage(this.Handle,WM_SYSCOMMAND , SC_MONITORPOWER,2);
SendMessage(this.Handle,WM_SYSCOMMAND , SC_MONITORPOWER,-1);