-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitor-dpms-04standby.ahk
71 lines (60 loc) · 1.63 KB
/
monitor-dpms-04standby.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
; Change Monitor Input Source by lifeweaver
; http://www.autohotkey.com/board/topic/96884-change-monitor-input-source/
; Finds monitor handle
getMonitorHandle()
{
; Initialize Monitor handle
hMon := DllCall("MonitorFromPoint"
, "int64", 0 ; point on monitor
, "uint", 1) ; flag to return primary monitor on failure
; Get Physical Monitor from handle
VarSetCapacity(Physical_Monitor, 8 + 256, 0)
DllCall("dxva2\GetPhysicalMonitorsFromHMONITOR"
, "int", hMon ; monitor handle
, "uint", 1 ; monitor array size
, "int", &Physical_Monitor) ; point to array with monitor
return hPhysMon := NumGet(Physical_Monitor)
}
destroyMonitorHandle(handle)
{
DllCall("dxva2\DestroyPhysicalMonitor", "int", handle)
}
; Used to change the monitor source
; DVI = 3
; HDMI = 4
; YPbPr = 12
setMonitorInputSource(source)
{
handle := getMonitorHandle()
DllCall("dxva2\SetVCPFeature"
, "int", handle
, "char", 0x60 ;VCP code for Input Source Select
, "uint", source)
destroyMonitorHandle(handle)
}
; Gets Monitor source
getMonitorInputSource()
{
handle := getMonitorHandle()
DllCall("dxva2\GetVCPFeatureAndVCPFeatureReply"
, "int", handle
, "char", 0x60 ;VCP code for Input Source Select
, "Ptr", 0
, "uint*", currentValue
, "uint*", maximumValue)
destroyMonitorHandle(handle)
return currentValue
}
; on = 1
; stby = 4
; ? = 5
setDpmsControl(cmd)
{
handle := getMonitorHandle()
DllCall("dxva2\SetVCPFeature"
, "int", handle
, "char", 0xd6
, "uint", cmd)
destroyMonitorHandle(handle)
}
setDpmsControl(4)