Jump to content

Search the Community

Showing results for tags 'WinGetClientSize'.

  • 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 3 results

  1. I am trying to do something, but it appears that I am having issues with trying to get the right functions called, in the right order. What I want to do is move a window to a certain position and then move it back, but as stated, the order appears to be an issue, as if the window is minimized, the wingetclientsize is not able to pull the info, not is the wingetpos. It appears to be able to get the size and position of the window in question is activated, but I have to activate it first, but that defeats the purpose, as once activated, the functions called to get the position and size, are not correct, as the screen is now active. I have tried to use wingetstate, to get the state first, but I am not sure how to move the window back to the original location with the right state. If window is minimized, I want it to go back to minimized state, as well as keeping the window size the same, so if the user activates the window, the user does not have to resize it. If the window is active and is on another screen, it appears I do not have the same issue. Here is my attempt, but I have tried other combinations. Has anyone got an idea on how to resolve this issue? Func MoveVNC($Move) CreateLogEntry("Called MoveVNC($Move) $Move = " & $Move) Local $aStartBar = StartBar() Local $bMove = False Local $VNC = 'NAMEOFWINDOW' Static $aWin_VNC_Pos = '' Static $iWin_VNC_State = '' Static $aWin_VNC_Size = '' #cs ;$aWin_VNC_Pos = WinGetPos($VNC, '') MsgBox('','VNC POS','') _ArrayDisplay(WinGetPos($VNC, '')) MsgBox('','VNC STATE',WinGetState($VNC, '')) WinActivate($VNC) Sleep(20) WinWaitActive($VNC, '', 10) Sleep(20) Local $aSize = WinGetClientSize($VNC, '') MsgBox('','VNC SIZE','') _ArrayDisplay($aSize) #ce If $Move = 'Get' Then Opt("WinTitleMatchMode", -1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase If WinExists($VNC) Then WinActivate($VNC) Sleep(20) WinWaitActive($VNC, '', 10) Sleep(20) $aWin_VNC_Pos = WinGetPos($VNC, '') Sleep(20) ;_ArrayDisplay($aWin_VNC_Pos, '$aWin_VNC_Pos') $iWin_VNC_State = WinGetState($VNC, '') Sleep(20) $aWin_VNC_Size = WinGetClientSize($VNC, '') ;_ArrayDisplay($aWin_VNC_Size) ;MsgBox('','$VNC',$VNC) ;MsgBox('', '$iWin_VNC_State', $iWin_VNC_State) ;WinSetState($VNC, '', @SW_MAXIMIZE) ;Sleep(20) WinMove($VNC, '', 0, 0, 1600, 950) ; - (3 * $aStartBar[3]) Sleep(20) ;MouseClick('Left', 1764, 174) $bMove = True Else MsgBox($MB_TOPMOST, 'ERROR GET', 'Window ' & $VNC & ' Does not exists - VNC is not running!') EndIf If Not $bMove Then CreateLogEntry("MoveVNC(GET) FAILED") Return False Else CreateLogEntry("MoveVNC(GET) PASSED") Return True EndIf ElseIf $Move = 'Put' Then CreateLogEntry("Called MoveVNC($Move) $Move = " & $Move) If WinExists($VNC) Then ;WinSetState($VNC, '', @SW_RESTORE) ;If @error Then MsgBox('', '', @error) ;Sleep(20) WinMove($VNC, '', $aWin_VNC_Pos[0], $aWin_VNC_Pos[1], $aWin_VNC_Pos[2], $aWin_VNC_Pos[3]) If @error Then MsgBox('', '', @error) Sleep(20) ;WinSetState($VNC, '', $iWin_VNC_State) ;If @error Then MsgBox('', 'Not setting state', @error & ' ' & $VNC) ;Sleep(20) $bMove = True Else MsgBox($MB_TOPMOST, 'ERROR PUT', 'Window ' & $VNC & ' Does not exists - VNC is not running!') EndIf If Not $bMove Then CreateLogEntry("MoveVNC(PUT) FAILED") Return False Else CreateLogEntry("MoveVNC(PUT) PASSED") Return True EndIf EndIf CreateLogEntry(" Returned from MoveVNC()") EndFunc ;==>MoveVNC
  2. 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
  3. This question is for WinGetClientSize and multiple screen sizes. When using WinGetClientSize in a Function, how to i then go on and set pixel search areas for example? Let's say i want to find the middle of a window; is there a %percentage syntax like in HTML ? Same problem goes for PixelCoordMode i think. It appears that i have to know every screen size usable beforehand.
×
×
  • Create New...