• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1109
  • Last Modified:

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.
0
unniuX
Asked:
unniuX
  • 2
  • 2
1 Solution
 
Svetlin_PanayotovCommented:
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
 
unniuXAuthor Commented:
I tried to use CreatedFile("\\\\.\\DISPLAY1",....) to get the monitor's handle , but it returned 5 (Access is denied). How to do?
0
 
Svetlin_PanayotovCommented:
Do you use Win NT (XP,2000,NT4)?
If you do - make sure you have admin rights.
Svetlin
0
 
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 : http://www.eu.microsoft.com/msj/0398/driver.aspx

I'v given up on it. Bye!
 
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now