On Mon, 30 May 2011 13:45:59 -0400, vefatica <> wrote:
|on my Dell WKS with two physical monitors before/after I put them into standby.
Interestingly, this simple code can tell whether the monitor is in (any) power
saving mode. But it can't tell if I have physically turned the monitor off. I
could easily include it in one of my plugins but I am uncertain about its value.
Code:
HANDLE hLCD = CreateFile(L"\\\\.\\LCD", GENERIC_READ | GENERIC_WRITE, 0,
0, OPEN_EXISTING, 0, 0);
BOOL bOn;
if ( GetDevicePowerState (hLCD, &bOn) )
wprintf(L"State: %d\n", bOn);
else
wprintf(L"Failed: %d\n", GetLastError());
CloseHandle(hLCD);
Code:
g:\projects\test\release> test.exe
State: 1
g:\projects\test\release> monitor off & delay 10 & test.exe
State: 0
Above, the "monitor" command sends (WM_SYSCOMMAND, SC_MONITORPOWER, flag).
Whether I give the power_down flag or the off flag, the monitor powers down.
When I do the above via RemoteDesktop on a computer which was locked and had its
monitors physically turned off 4 days ago, I get the seemingly correct result
... "State: 0".