Jump to content

Search the Community

Showing results for tags '_istaskbarvisible()'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. CODE: ; ============================================ ; Functions to check taskbar visibility and position ; ============================================ ; ------------------------------------------------------------ ; Function: _IsTaskbarVisible ; Purpose : Check whether the Windows taskbar is visible ; Return : True - Taskbar is visible ; False - Taskbar is hidden or not found ; Author : Dao Van Trong - TRONG.PRO ; Example : ; If _IsTaskbarVisible() Then MsgBox(0, "Status", "Visible") ; ------------------------------------------------------------ Func _IsTaskbarVisible() ; Get the handle to the taskbar Local $hTaskbar = WinGetHandle("[CLASS:Shell_TrayWnd]") If @error Then Return False ; Taskbar not found ; Get the position and size of the taskbar Local $aPos = WinGetPos($hTaskbar) If @error Then Return False ; Get the screen dimensions Local $iScreenWidth = @DesktopWidth Local $iScreenHeight = @DesktopHeight ; When the taskbar is hidden, its coordinates may be off-screen: ; Top taskbar: Y < 0 ; Left taskbar: X < 0 ; Right taskbar: X + Width > DesktopWidth ; Bottom taskbar: Y + Height > DesktopHeight ; Check if the taskbar is visible If $aPos[0] < 0 Or $aPos[1] < 0 Or _ $aPos[0] + $aPos[2] > $iScreenWidth Or _ $aPos[1] + $aPos[3] > $iScreenHeight Then Return False ; Taskbar is hidden Else Return True ; Taskbar is visible EndIf EndFunc ;==>_IsTaskbarVisible ; ------------------------------------------------------------ ; Function: _GetTaskbarPosition ; Purpose : Get the position of the Windows taskbar ; Return : SetError(0, code, "position") ; code: 1=top, 2=bottom, 3=left, 4=right ; SetError(3, 0, "unknown") if not determined ; Author : Dao Van Trong - TRONG.PRO ; Example : ; $pos = _GetTaskbarPosition() ; MsgBox(0, "Taskbar Position", $pos & " / code: " & @extended) ; ------------------------------------------------------------ Func _GetTaskbarPosition() Local $hTaskbar = WinGetHandle("[CLASS:Shell_TrayWnd]") If @error Then Return SetError(1, 0, "") ; Taskbar not found Local $aPos = WinGetPos($hTaskbar) If @error Then Return SetError(2, 0, "") ; Error getting taskbar position Local $iScreenWidth = @DesktopWidth Local $iScreenHeight = @DesktopHeight Local $tolerance = 5 ; Tolerance threshold in pixels ; Check top/bottom positions If Abs($aPos[0]) <= $tolerance And Abs($aPos[2] - $iScreenWidth) <= $tolerance Then If Abs($aPos[1]) <= $tolerance Then Return SetError(0, 1, "top") If Abs($aPos[1] + $aPos[3] - $iScreenHeight) <= $tolerance Then Return SetError(0, 2, "bottom") EndIf ; Check left/right positions If Abs($aPos[1]) <= $tolerance And Abs($aPos[3] - $iScreenHeight) <= $tolerance Then If Abs($aPos[0]) <= $tolerance Then Return SetError(0, 3, "left") If Abs($aPos[0] + $aPos[2] - $iScreenWidth) <= $tolerance Then Return SetError(0, 4, "right") EndIf ; If taskbar is hidden, infer its position from off-screen coordinates If Not _IsTaskbarVisible() Then If $aPos[1] < 0 Then Return SetError(0, 1, "top") If $aPos[0] < 0 Then Return SetError(0, 3, "left") If $aPos[1] + $aPos[3] - $iScreenHeight > $tolerance Then Return SetError(0, 2, "bottom") If $aPos[0] + $aPos[2] - $iScreenWidth > $tolerance Then Return SetError(0, 4, "right") EndIf Return SetError(3, 0, "unknown") ; Position could not be determined EndFunc ;==>_GetTaskbarPosition ;~ ; ------------------------------------------------------------ ;~ ; Example usage ;~ ; ------------------------------------------------------------ ;~ Local $sPos = _GetTaskbarPosition() ;~ Local $iCode = @extended ;~ If _IsTaskbarVisible() Then ;~ MsgBox(0, "Taskbar Status", _ ;~ "Taskbar is visible" & @CRLF & _ ;~ "Taskbar position: " & $sPos & @CRLF & _ ;~ "Position code : " & $iCode) ;~ Else ;~ MsgBox(0, "Taskbar Status", _ ;~ "Taskbar is hidden" & @CRLF & _ ;~ "Taskbar position: " & $sPos & @CRLF & _ ;~ "Position code : " & $iCode) ;~ EndIf EG: ; ------------------------------------------------------------ ; Example usage ; ------------------------------------------------------------ Local $sPos = _GetTaskbarPosition() Local $iCode = @extended If _IsTaskbarVisible() Then MsgBox(0, "Taskbar Status", _ "Taskbar is visible" & @CRLF & _ "Taskbar position: " & $sPos & @CRLF & _ "Position code : " & $iCode) Else MsgBox(0, "Taskbar Status", _ "Taskbar is hidden" & @CRLF & _ "Taskbar position: " & $sPos & @CRLF & _ "Position code : " & $iCode) EndIf
×
×
  • Create New...