Detecting if the monitor is powered off

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
alesyt0h
Posts: 214
Joined: 28 Jan 2015, 20:37

Detecting if the monitor is powered off

28 Apr 2017, 11:58

Hello

Is any way to detect if a monitor is currently powered on/off or in standby?

Thank yoU!
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Re: Detecting if the monitor is powered off

01 May 2017, 09:52

You can check here and also this might help also... You would have to use dllcall to use these functions :)
alesyt0h
Posts: 214
Joined: 28 Jan 2015, 20:37

Re: Detecting if the monitor is powered off

05 May 2017, 16:50

sancarn wrote:You can check here and also this might help also... You would have to use dllcall to use these functions :)
After some digging about GetDevicePowerState I found a little code in the old forums about it:

Code: Select all

hDisp := DllCall("CreateFile","Str","\\.\LCD","Uint",0xC0000000,"Uint",0x3,"Uint",0,"Uint",0x3,"Uint",0,"Uint",0)

DllCall("GetDevicePowerState", "UInt", hDisp, "IntP", stat)
Always returns 0, I guess I have to change the "\\.\LCD" value to match the ID of monitor? I don't know what to put in there.

About the last link you posted I have to compile it with visual studio?

Thanks!
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Detecting if the monitor is powered off

12 May 2017, 05:55

msdn wrote:GetDevicePowerState function
Retrieves the current power state of the specified device. This function cannot be used to query the power state of a display device.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest, serenite and 168 guests