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);