1

I have done following code for turning off my display and turn it on after a delay. Turn off works like a charm but turning on not working properly that is it is asking for machine password . I need just to turn off and turn on display. What is wrong with the following code ? Anyone having idea? I have 2 extended displays.

SendMessage(hwnd, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MonitorState.OFF);
await Task.Delay(100);
SendMessage(hwnd, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)MonitorState.ON);
Alias Varghese
  • 2,104
  • 3
  • 24
  • 52
  • Though silly, but did you check what are Sleep/Display/Power settings of your system? – Siva Gopal Jan 05 '16 at 05:21
  • Can you please specify what will be wrong with my settings? – Alias Varghese Jan 05 '16 at 05:24
  • 3
    Though you didn't specified which OS are you on, but for example, if you take Windows10 you see `Control Panel>All Control Panel Items>Power Options>System Settings` where you can set 'Require a password on wake-up' setting. Also check [this SO](http://stackoverflow.com/questions/713498/turn-on-off-monitor) answers. – Siva Gopal Jan 05 '16 at 05:28

1 Answers1

1

Though you didn't specified which OS are you on, but for example, if you take Windows10 you see Control Panel>All Control Panel Items>Power Options>System Settings where you can set 'Require a password on wake-up' setting. Thanks Siva

Alias Varghese
  • 2,104
  • 3
  • 24
  • 52