开发者

Is it possible to put a single monitor to sleep using WinAPI/C#?

By using the Windows API it is possible to put the monitors into sleep mode:

[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

and then

SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)2);

When runni开发者_Python百科ng the command above, both monitors go to sleep. Is it possible to make this affect only one of multiple connected monitors?


Exactly I don't know if you can put into sleep a specific monitor.. but you can achieve this by changing number of displays to One (assuming you have 2), which you want to be awake. The other one will automatically goes to sleep after about a minute (most monitors enter power save mode after about a minute after disconnect). You are essentially disconnecting the monitor, programatically. You can activate it when you need it.

However this method will have other implications, which you will know once you start playing with it.


According to this...no.

The reason being is that the API is turning off the display which is defined as both monitors. Turning off a specific monitor would be a hardware tie in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜