|
附上我常用的代码给大家参考
Shift + F1:萤幕待机
Shift + F2:萤幕关机
- #SingleInstance Force
- #NoEnv
- +F1::
- Sleep 100
- SendMessage 0x112, 0xF170, 2, , Program Manager
- Return
- +F2::
- LCD_PowerOFF()
- Return
- LCD_PowerOFF()
- {
- ; Step1:Find Monitor Handle
- ; 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
- handle := NumGet(Physical_Monitor)
- ; Step2:Change Power Mode
- DllCall("dxva2\SetVCPFeature"
- , "int", handle
- , "char", 0xD6 ;VCP code for Power Mode
- , "uint", 0x05)
- ; Step3:Destroy Monitor Handle
- DllCall("dxva2\DestroyPhysicalMonitor", "int", handle)
- }
复制代码 |
评分
-
查看全部评分
|