Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Need for stroke " Local $hWnd = _WinAPI_GetDesktopWindow() "
- #include <WinAPISys.au3>
- ; Need for stroke " Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor)) "
- #include <String.au3>
- ; Need for stroke " Local $aPos, $aData = _WinAPI_EnumDisplayMonitors() "
- ; Need for stroke " $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST) "
- #include <WinAPIGdi.au3>
- Local $aPos, $aData = _WinAPI_EnumDisplayMonitors()
- Local $hWnd = _WinAPI_GetDesktopWindow()
- $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST)
- Local $aRet = DllCall("Dxva2.dll", "int", "GetNumberOfPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int*", 0)
- Local $iNumberMonitor = $aRet[2]
- Const $tag_PHYSICAL_MONITOR = "handle hPhysicalMonitor; wchar strPhysicalMonitorDescription[128];"
- Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor))
- $aRet = DllCall("Dxva2.dll", "int", "GetPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int", $iNumberMonitor, "struct*", $tPhysicalMonitor)
- ; Off monitor
- ; $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _
- ; "byte", 0xD6, "int", 0x04)
- ; On monitor
- ; DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _
- ; "byte", 0xD6, "int", 0x01)
- ; Off monitor - peredacha v konetc stroku 0x04
- _Monitor_Switch_Alt_AIO(True)
- ; On monitor - peredacha v konetc stroku 0x01
- _Monitor_Switch_Alt_AIO(False)
- Func _Monitor_Switch_Alt_AIO(bOff)
- DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, "byte", 0xD6, "int", ($bOff ? 0x04: 0x01))
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement