Jump to content

Search the Community

Showing results for tags 'Useable Desktop Size'.

  • 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. I found >this thread started by chuber while searching for a way to get the useable desktop area (size of primary monitor desktop minus taskbar). My first bit of bafflement was why the code written by chuber does not match the quote of his code in the reply that follows his post. Since I didn't want to tackle figuring out Sysinternal's debug viewer I went with the version of his code that omits all the lines starting with "If $DEBUG_001...". (more is omitted than that but I think it's missing only comments) I'll paste this version below. It compiles fine. What chuber posted is a function. So my first goal is to write a simple MsgBox that will show me the results of his function. When I insert a simple MsgBox to see the results of his function... MsgBox(0,"test",$aDesktop_Pos[0]) ...I get an error saying "Subscript used with non-Array variable.", yet he used $aDesktop_Pos as an array variable throughout his function and it's a global variable. What part of this do I not understand and how can I extract the info I'm seeking? Here's the code from the original thread. ; #cs Script: Desktop client size and Taskbar position (code snippet) Author: Bruce Huber (cbruce) AutoIt: v3.2.12.1 Date: 2008.08.13 - Original release Purpose: Determine whether the Taskbar is visible or hidden and where it is docked on the Desktop. Also calculate the available Desktop client region, accounting for any Taskbar space. #ce ; Desktop and Taskbar position information - GetDesktopAndTaskbarPos(). Global Enum $DTP_X, $DTP_Y, $DTP_W, $DTP_H Global $aDesktop_Pos, $aTaskbar_Pos Global Enum $TBDL_UNKNOWN, $TBDL_LEFT, $TBDL_RIGHT, $TBDL_TOP, $TBDL_BOTTOM Global $Taskbar_Dock_Location = $TBDL_UNKNOWN Global $Taskbar_Visible Func GetDesktopAndTaskbarPos() ; Get the Desktop size - which includes the Taskbar space, if the Taskbar is visible. $aDesktop_Pos = WinGetPos( "Program Manager") ; Get the Taskbar size. $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]") ; Determine if Taskbar is taking up space on the Desktop. If ( $aTaskbar_Pos[$DTP_X] > -3) And ( $aTaskbar_Pos[$DTP_Y] > -3) And ( $aTaskbar_Pos[$DTP_X] < ( $aDesktop_Pos[$DTP_W] - 5)) And ( $aTaskbar_Pos[$DTP_Y] < ( $aDesktop_Pos[$DTP_H] - 5)) Then ; Taskbar is Visible. $Taskbar_Visible = True ; Calculate the parameters of the AVAILABLE Desktop client region. If ( $aTaskbar_Pos[$DTP_X] < 1) and ( $aTaskbar_Pos[$DTP_Y] > 0) and ( $aTaskbar_Pos[$DTP_W] > $aTaskbar_Pos[$DTP_H]) Then ; Taskbar is on the BOTTOM. $Taskbar_Dock_Location = $TBDL_BOTTOM ; We need to adjust the Desktop Height. $aDesktop_Pos[$DTP_H] = $aTaskbar_Pos[$DTP_Y] - 1 ElseIf ( $aTaskbar_Pos[$DTP_X] < 1) and ( $aTaskbar_Pos[$DTP_Y] < 1) and ( $aTaskbar_Pos[$DTP_W] < $aTaskbar_Pos[$DTP_H]) Then ; Taskbar is on the LEFT. $Taskbar_Dock_Location = $TBDL_LEFT ; We need to adjust the Desktop X and Width. $aDesktop_Pos[$DTP_X] = $aTaskbar_Pos[$DTP_X] + $aTaskbar_Pos[$DTP_W] + 1 $aDesktop_Pos[$DTP_W] = $aTaskbar_Pos[$DTP_X] - 1 ElseIf ( $aTaskbar_Pos[$DTP_X] > 0) and ( $aTaskbar_Pos[$DTP_Y] < 1) and ( $aTaskbar_Pos[$DTP_W] < $aTaskbar_Pos[$DTP_H]) Then ; Taskbar is on the RIGHT. $Taskbar_Dock_Location = $TBDL_RIGHT ; We need to adjust the Desktop Width. $aDesktop_Pos[$DTP_W] = $aTaskbar_Pos[$DTP_X] - 1 ElseIf ( $aTaskbar_Pos[$DTP_X] < 1) and ( $aTaskbar_Pos[$DTP_Y] < 1) and ( $aTaskbar_Pos[$DTP_W] > $aTaskbar_Pos[$DTP_H]) Then ; Taskbar is on the TOP. $Taskbar_Dock_Location = $TBDL_TOP ; We need to adjust the Desktop Y and Height. $aDesktop_Pos[$DTP_Y] = $aTaskbar_Pos[$DTP_Y] + $aTaskbar_Pos[$DTP_H] + 1 $aDesktop_Pos[$DTP_H] = $aTaskbar_Pos[$DTP_Y] - 1 Else ; Where the heck has the Taskbar gone? $Taskbar_Dock_Location = $TBDL_UNKNOWN EndIf Else ; Taskbar is Hidden. $Taskbar_Visible = False EndIf #cs $aDesktop_Pos now contains parameters that only define the AVAILABLE Desktop client region. This will be the entire Desktop if the Taskbar is hidden. Otherwise, the region will be the Desktop area minus the Taskbar area. $Taskbar_Dock_Location now specifies WHERE, on the Desktop, that the Taskbar is docked. #ce EndFunc ; GetDesktopAndTaskbarPos() ; I realize there's> a post in another thread that uses a different approach to finding the data I seek but all I need are "x,y,h,w" and I can't figure out how to extact that info from the script provided in that code (copy pasted below). This is humbling. Global Const $MONITOR_DEFAULTTONULL = 0x00000000 Global Const $MONITOR_DEFAULTTOPRIMARY = 0x00000001 Global Const $MONITOR_DEFAULTTONEAREST = 0x00000002 Global Const $CCHDEVICENAME = 32 Global Const $MONITORINFOF_PRIMARY = 0x00000001 $hMonitor = GetMonitorFromPoint(0, 0) ;$hMonitor = GetMonitorFromPoint(-2, 0) ;$hMonitor = GetMonitorFromPoint(@DesktopWidth, 0) If $hMonitor <> 0 Then Dim $arMonitorInfos[4] If GetMonitorInfos($hMonitor, $arMonitorInfos) Then _ Msgbox(0, "Monitor-Infos", "Rect-Monitor" & @Tab & ": " & $arMonitorInfos[0] & @LF & _ "Rect-Workarea" & @Tab & ": " & $arMonitorInfos[1] & @LF & _ "PrimaryMonitor?" & @Tab & ": " & $arMonitorInfos[2] & @LF & _ "Devicename" & @Tab & ": " & $arMonitorInfos[3]) EndIf Exit Func GetMonitorFromPoint($x, $y) $hMonitor = DllCall("user32.dll", "hwnd", "MonitorFromPoint", _ "int", $x, _ "int", $y, _ "int", $MONITOR_DEFAULTTONULL) Return $hMonitor[0] EndFunc Func GetMonitorInfos($hMonitor, ByRef $arMonitorInfos) Local $stMONITORINFOEX = DllStructCreate("dword;int[4];int[4];dword;char[" & $CCHDEVICENAME & "]") DllStructSetData($stMONITORINFOEX, 1, DllStructGetSize($stMONITORINFOEX)) $nResult = DllCall("user32.dll", "int", "GetMonitorInfo", _ "hwnd", $hMonitor, _ "ptr", DllStructGetPtr($stMONITORINFOEX)) If $nResult[0] = 1 Then $arMonitorInfos[0] = DllStructGetData($stMONITORINFOEX, 2, 1) & ";" & _ DllStructGetData($stMONITORINFOEX, 2, 2) & ";" & _ DllStructGetData($stMONITORINFOEX, 2, 3) & ";" & _ DllStructGetData($stMONITORINFOEX, 2, 4) $arMonitorInfos[1] = DllStructGetData($stMONITORINFOEX, 3, 1) & ";" & _ DllStructGetData($stMONITORINFOEX, 3, 2) & ";" & _ DllStructGetData($stMONITORINFOEX, 3, 3) & ";" & _ DllStructGetData($stMONITORINFOEX, 3, 4) $arMonitorInfos[2] = DllStructGetData($stMONITORINFOEX, 4) $arMonitorInfos[3] = DllStructGetData($stMONITORINFOEX, 5) EndIf Return $nResult[0] EndFunc
×
×
  • Create New...