Function Reference


WinGetClientSize

Retrieves the size of a given window's client area.

WinGetClientSize ( "title" [, "text"] )

Parameters

title The title/hWnd/class of the window to get the size. See Title special definition.
text [optional] The text of the window to get the size. Default is an empty string. See Text special definition.

Return Value

Success: a 2-element array containing the following information:
    $aArray[0] = Width of window's client area
    $aArray[1] = Height of window's client area
Failure: sets the @error flag to non-zero if the window is not found.

Remarks

If the window is minimized, the returned width and height values are both zero. However, WinGetClientSize() works correctly on (non-minimized) hidden windows. If the window title "Program Manager" is used, the function will return the size of the desktop. If multiple windows match the criteria, the most recently active window is used.

Related

WinGetPos, WinMove

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Run Notepad
        Run("notepad.exe")

        ; Wait 10 seconds for the Notepad window to appear.
        Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

        ; Retrieve the client area of the Notepad window using the handle returned by WinWait.
        Local $aClientSize = WinGetClientSize($hWnd)

        ; Display the height and width of the client area.
        MsgBox($MB_SYSTEMMODAL, "", "Width: " & $aClientSize[0] & @CRLF & "Height: " & $aClientSize[1])

        ; Close the Notepad window using the handle returned by WinWait.
        WinClose($hWnd)
EndFunc   ;==>Example