Archive

Posts Tagged ‘hardware hibernate’

How to programmatically turn on/off your monitor

April 3rd, 2009 Comments

Powerbutton

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

Categories: Uncategorized Tags: , , , ,

Your Windows Vista not working after sleep or hibernation?

November 22nd, 2007 Comments

After installing Windows Vista in my machine, my sound card was not working after sleeping or hibernation… What the hell? Anyway just apply this hot-fix to get life back for your sound hardware.

http://support.microsoft.com/kb/937077/