Recently I saw an interesting question in Stackoverflow forum on programatically turn on/off monitor. Do you want to turn off your monitor programmatically? It’s not a secret in windows. It’s simple as sending a message
You can send a WM_SYSCOMMAND message with SC_MONITORPOWER and state requried as message parameters. See the function below
[sourcecode language='cpp']
const int MONITOR_ON = -1;
const int MONITOR_OFF = 2;
const int MONITOR_STANDBY = 1;
void SetMonitorPowerState( HWND hWnd, const int state )
{
::SendMessage( hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, state );
}
[/sourcecode]
You can pass your own window as parameter or replace parameter with HWND_BROADCAST to send this message to all top level windows. Alternately you can use GetDesktopWindow() as well. Anyway I am totally unable to distiguish between off and standby while we do it programatically. You can turn on the monitor by mouse movement or keypress. [BTW, the image displayed above is designed myself some time back with the help of a tutorial available in YouTube. (Sorry I missed the link)]
See few links on same topic
Turn off your monitor via code (C#)
Monitor Management