3

How do I turn the monitor back on after the idle timer has turned it off? I have power options in windows 7 set to:
Turn off monitor after: 1 minute
Go to sleep: Never

But I don't know how to turn it back on through code.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
PatTech
  • 397
  • 2
  • 10

2 Answers2

1

This looks promising: http://www.codeproject.com/KB/cs/Monitor_management_guide.aspx

It uses the"SendMessage" API call:

SC_MONITORPOWER Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer. The lParam parameter can have the following values:

-1 - the display is powering on

1 - the display is going to low power

2 - the display is being shut off

David
  • 34,223
  • 3
  • 62
  • 80
0

Do you need to turn it on, or just prevent it from turning off? If the latter, you can use the WinAPI:

SetThreadExecutionState(ES_DISPLAY_REQUIRED)

I don't think that there is a .net wrapper built in, but you should be able to pInvoke it.

JMarsch
  • 21,484
  • 15
  • 77
  • 125