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);
[in] Handle to an object on the device, such as a file or socket, or a handle to the device itself.
[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.
Who is Participating?
Svetlin_PanayotovConnect With a Mentor Commented:
Here's a MFC class that contains the info you need - or at least how to get monitor's name.After retrieving it you can call CreateFile to get the handle.
unniuXAuthor Commented:
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.
unniuXAuthor Commented:
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 :

I'v given up on it. Bye!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.