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

Posted on 2004-09-23
Last Modified: 2008-01-09
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.
Question by:unniuX
  • 2
  • 2

Accepted Solution

Svetlin_Panayotov earned 50 total points
ID: 12140354
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.

Author Comment

ID: 12149210
I tried to use CreatedFile("\\\\.\\DISPLAY1",....) to get the monitor's handle , but it returned 5 (Access is denied). How to do?

Expert Comment

ID: 12152953
Do you use Win NT (XP,2000,NT4)?
If you do - make sure you have admin rights.

Author Comment

ID: 12167467
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!

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need to convert MSDEV 6.0 to Dev Studio 2010 5 31
How can I tell if an app is 32 or 64 bit? 7 154
using dll from another object 1 94
Paint/Redraw window while dragging 16 82
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question ( here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question