Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; #Function# ===========================================================================================================================================
- ; Name............: _ScreenGetSize
- ; Description.....: Returns an Rectangle containing the coordinates of the desktop without taskbar
- ; Syntax..........: _ScreenGetSize($fAlwaysVisible = False)
- ; Parameters......:
- ; $fAlwaysVisible - [optional] Taskbar is calculated as visible if it is not
- ; Return values .:
- ; Success - Array with Rect structure [x1, y1, x2, y2]
- ; Failure - 0 and sets error if the taskbar could not be found
- ; Author .........: FichteFoll
- ; Modified........:
- ; Remarks ........:
- ; Related ........: @DesktopWidth, @DesktopHeight
- ; Example ........; $ret = _ScreenGetSize()
- ; ConsoleWrite("" & $ret[4]
- ; ======================================================================================================================================================
- Func _ScreenGetSize($fAlwaysVisible = False)
- Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4), $aResult[4]
- Local $aTaskBar_Pos = WinGetPos("[CLASS:Shell_TrayWnd]"), $aDesktop[2] = [@DesktopWidth, @DesktopHeight]
- AutoItSetOption("WinTitleMatchMode", $iPrevMode)
- If Not IsArray($aTaskBar_Pos) Then Return 0 * SetError(1)
- Local $i = ($aTaskBar_Pos[3] = $aDesktop[1]) ; 0 = top/bottom, 1 = left/right
- $aResult[$i] = 0
- $aResult[Not $i] = 0 + ($aTaskBar_Pos[Not $i] < $aDesktop[Not $i] / 2) _
- * ($fAlwaysVisible * $aTaskBar_Pos[Not $i + 2]) _
- + ($aTaskBar_Pos[Not $i] < $aDesktop[Not $i] / 2) _
- * (Not $fAlwaysVisible * ($aTaskBar_Pos[Not $i] + $aTaskBar_Pos[Not $i + 2]))
- $aResult[$i + 2] = $aDesktop[$i]
- $aResult[Not $i + 2] = 0 + ($aTaskBar_Pos[Not $i] < $aDesktop[Not $i] / 2) * $aDesktop[Not $i] _
- + ($aTaskBar_Pos[Not $i] > $aDesktop[Not $i] / 2) _
- * ($fAlwaysVisible * ($aDesktop[Not $i] - $aTaskBar_Pos[Not $i + 2])) _
- + ($aTaskBar_Pos[Not $i] > $aDesktop[Not $i] / 2) _
- * (Not $fAlwaysVisible * $aTaskBar_Pos[Not $i])
- Return $aResult
- EndFunc ;==>_ScreenGetSize
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement