Link to home
Start Free TrialLog in
Avatar of unniuX
unniuX

asked on

How to get the power state of a monitor?(working, low power or soft off)

Maybe this API function can do, but I don't know how to get the handle of the monitor.
Could you help me?

BOOL GetDevicePowerState(  HANDLE hDevice,  BOOL* pfOn);
Parameters
hDevice
[in] Handle to an object on the device, such as a file or socket, or a handle to the device itself.
pfOn
[out] Pointer to the variable that receives the power state. This value is TRUE if the device is in the working state. Otherwise, it is FALSE.
ASKER CERTIFIED SOLUTION
Avatar of Svetlin_Panayotov
Svetlin_Panayotov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of unniuX
unniuX

ASKER

I tried to use CreatedFile("\\\\.\\DISPLAY1",....) to get the monitor's handle , but it returned 5 (Access is denied). How to do?
Do you use Win NT (XP,2000,NT4)?
If you do - make sure you have admin rights.
Svetlin
Avatar of unniuX

ASKER

Thanks, Svethlin. But there's no way to get the handle of a monitor, because "the DISPLAY symbolic link is off-limits to everyone, including users with administrator rights. The premise behind this is that the Windows NT kernel should be the only one that has control of the video display. "

refer to : http://www.eu.microsoft.com/msj/0398/driver.aspx

I'v given up on it. Bye!