通过C#调用API让计算机关闭屏幕
[System.Runtime.InteropServices.DllImport("User32.DLL")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
bool monitorOpen = true;
const int WM_SYSCOMMAND = 0x0112;
const int SC_MONITORPOWER = 61808;
monitorOpen = !monitorOpen;
SendMessage(Handle, WM_SYSCOMMAND, SC_MONITORPOWER, monitorOpen ? 0 : 1);