9

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 running the command above, both monitors go to sleep. Is it possible to make this affect only one of multiple connected monitors?

Bergi
  • 513,640
  • 108
  • 821
  • 1,164
Erlend D.
  • 2,867
  • 6
  • 32
  • 53

2 Answers2

2

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.

Aaron McIver
  • 23,797
  • 5
  • 53
  • 83
2

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.

Bhuvan
  • 1,461
  • 3
  • 22
  • 46
  • Like windows on the second monitor being moved :) – Basic Jan 26 '11 at 17:20
  • @Erlend: If you have achieved this.. can you post on how you made it possible.. I currently is looking for similar solution.. And while I have suggested an approach.. trying to find how you got it worked.. if at all.. – Bhuvan Feb 01 '11 at 00:35
  • Unfortunately, I could not achieve this. – Erlend D. Aug 31 '11 at 15:04