WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WMI
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Detect If monitor is in Standby Mode

 Keywords:  monitor screen standby mode power saving win32_DesktopMonitor

Question:

Please can someone point me in the right direction to code how I detect when the monitor has gone into standby (due to the powersaving scheme). Thanks

Answer:

; See WMI documentation at http://msdn.microsoft.com/en-us/library/aa394122(VS.85).aspx

strComputer = "."
objWMIService = GetObject("winmgmts:\\" : strComputer : "\root\cimv2")
colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)
ForEach objItem In colItems
    Switch objItem.Availability
    Case 1
    strStatus = "Other"
    Break
    Case 2
    strStatus = "Unknown"
    Break
    Case 3
    strStatus = "Running or Full Power"
    Break
    Case 4
    strStatus = "Warning"
    Break
    Case 5
    strStatus = "In Test"
    Break
    Case 6
    strStatus = "Not Applicable"
    Break
    Case 7
    strStatus = "Power Off"
    Break
    Case 8
    strStatus = "Off Line"
    Break
    Case 9
    strStatus = "Off Duty"
    Break
    Case 10
    strStatus = "Degraded"
    Break
    Case 11
    strStatus = "Not Installed"
    Break
    Case 12
    strStatus = "Install Error"
    Break
    Case 13
    strStatus = "Power Save - Unknown"
    Break
    Case 14
    strStatus = "Power Save - Low Power Mode"
    Break
    Case 15
    strStatus = "Power Save - Standby"
    Break
    Case 16
    strStatus = "Power Cycle"
    Break
    Case 17
    strStatus = "Power Save - Warning"
    Break
    EndSwitch
    Message(objItem.Name, strStatus)
Next
Exit

Article ID:   W18467
Filename:   Detect If monitor is in Standby Mode.txt
File Created: 2010:06:11:10:05:08
Last Updated: 2010:06:11:10:05:08