Advertisement
SharkyEXE

Untitled

Jul 17th, 2022
2,456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.72 KB | None | 0 0
  1. ; Need for stroke " Local $hWnd = _WinAPI_GetDesktopWindow() "
  2. #include <WinAPISys.au3>
  3.  
  4. ; Need for stroke " Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor)) "
  5. #include <String.au3>
  6.  
  7. ; Need for stroke " Local $aPos, $aData = _WinAPI_EnumDisplayMonitors() "
  8. ; Need for stroke " $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST) "
  9. #include <WinAPIGdi.au3>
  10.  
  11. Local $aPos, $aData = _WinAPI_EnumDisplayMonitors()
  12.  
  13. Local $hWnd = _WinAPI_GetDesktopWindow()
  14. $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST)
  15.  
  16. Local $aRet = DllCall("Dxva2.dll", "int", "GetNumberOfPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int*", 0)
  17. Local $iNumberMonitor = $aRet[2]
  18. Const $tag_PHYSICAL_MONITOR = "handle hPhysicalMonitor; wchar strPhysicalMonitorDescription[128];"
  19. Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor))
  20. $aRet = DllCall("Dxva2.dll", "int", "GetPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int", $iNumberMonitor, "struct*", $tPhysicalMonitor)
  21.  
  22. ; Off monitor
  23.  
  24. ; $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _
  25. ;   "byte", 0xD6, "int", 0x04)
  26.  
  27. ; On monitor
  28.  
  29. ; DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _
  30. ;   "byte", 0xD6, "int", 0x01)
  31.  
  32. ; Off monitor - peredacha v konetc stroku 0x04
  33. _Monitor_Switch_Alt_AIO(True)
  34.  
  35. ; On monitor - peredacha v konetc stroku 0x01
  36. _Monitor_Switch_Alt_AIO(False)
  37.  
  38. Func _Monitor_Switch_Alt_AIO(bOff)
  39. DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, "byte", 0xD6, "int", ($bOff ? 0x04: 0x01))
  40. EndFunc
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement