Solved

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

Posted on 2004-09-23
4
1,048 Views
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);
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.
0
Comment
Question by:unniuX
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
Svetlin_Panayotov earned 50 total points
Comment Utility
http://www.codeproject.com/gdi/multimon.asp?print=true
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.
Svetlin
0
 

Author Comment

by:unniuX
Comment Utility
I tried to use CreatedFile("\\\\.\\DISPLAY1",....) to get the monitor's handle , but it returned 5 (Access is denied). How to do?
0
 
LVL 6

Expert Comment

by:Svetlin_Panayotov
Comment Utility
Do you use Win NT (XP,2000,NT4)?
If you do - make sure you have admin rights.
Svetlin
0
 

Author Comment

by:unniuX
Comment Utility
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!
 
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) 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 discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now