Link to home
Start Free TrialLog in
Avatar of ThievingSix
ThievingSixFlag for United States of America

asked on

Is computer moniter turned on?

Simple question with a no doubt difficult answer. Is it possible for Windows to tell if a monitor is turned on/off?
Avatar of volumeIII
volumeIII

Yes, but it will be more of a status which the operating system controls.  for example, the computer can have the video card turned on or off.  If you plug a monitor into the video card, since the computer controls the video card, it knows the status... Having said that, if the video card is on and the user unplugs the monitor from the wall, it will still think the status is 'on'.

For more detail, look up the function SendMessage and the parameter WM_POWERBROADCAST

Br
Avatar of andrew_aj1
I believe you must have a compabiatle video card  and monitor for this to work correctly.
Avatar of ThievingSix

ASKER

It seems WM_POWERBROADCAST only deals with battery life and windows suspend. Doesn't Windows turn the monitor off, then back on when you move the mouse? This said, wouldn't it know whether the monitor is turned on?
Windows does not turn the monitor off. Windows does have power options to tell the video card to stop outputting to the monitor and the monitor goes into a low power mode because of this.
If the monitor is turned off does the video card continue outputting data? Wouldn't the plug and play detection prevent this?
If the monitor is turned off the video card will continue outputting data until windows tells it to enter a sleep mode then it will stop until the mouse is moved, key is pressed, etc.
Why does this really mater if you don't mind me asking?
Well I was hoping that if the monitor wasn't accepting data that the video card wouldn't output data. My reasoning is I was hoping to execute an application once the monitor was turned off. Reason why I asked if the video card would keep outputting data was if it did in fact stop once the monitor was off I would find a way to check that.

Any ideas on a work around?
ASKER CERTIFIED SOLUTION
Avatar of andrew_aj1
andrew_aj1
Flag of United States of America image

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
Well, not in the way you said it. But I don't think there is a definitive way to detect the monitor off in the first place. I'll leave this question open for about a day to see if anyone else has input.
I would say that Windows has no knowledge of whether the monitor is on or off, but you can test this by doing a test with two different monitors that are Plug & Play, that have different characteristics in Display in the Windows Control Panel.  Does the action of taking one screen off and putting the other one without shutting down Windows during the process cause a re-detection to take place?  

If it does, then use utilities from www.Sysinternals.com to show what Messages were flying around at the time of the changeover.  In between those changeover messages, look out for Messages from the same source which might indicate a "no display" state.  

Bear in mind that, even if this works, it is no guide to being a universal solution i.e., fine for software tailored for a particular pc, but no good for off-the-shelf products.

Work arounds:-

(1) If the Monitor has in-built sound, you could try detecting Sound being available - on my pc, which has an MSI mainboard, when I plug in Headphones I get a message on the screen which asks me what have I just plugged in.  Whether this works with "speakers switched on" and "speakers switched off" modes (as opposed to being plugged or unplugged), I don't know.

(2) The other thing you could do is have some kind of separate box which detects mains power flow to a device, which generates a message to say whether or not the device is switched on - nowadays, if such a device were available, it would be a network connected device.  Bear in mind that there would be a delay between the monitor being switched off, and the unit detecting that the power had gone off - this is because the mains would be replenishing charge in capacitors in the monitor power supply before current were seen to be cut.
Sort of thing I was talking about doesn't seem to be available off the shelf, but here's some diy examples:-

http://sound.westhost.com/project40.htm
http://sound.westhost.com/project79.htm
http://www.aaroncake.net/circuits/loadswitch.asp