# Function Reference

WinGetPos

Retrieves the position and size of a given window.

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

Parameters

title | The title of the window to read. See Title special definition.
text | [optional] The text of the window to read.

Return Value

Success: | Returns a 4-element array containing the following information:
| $array[0] = X position
| $array[1] = Y position
| $array[2] = Width
| $array[3] = Height
Failure: | Returns 0 and sets @error to 1 if windows is not found.

Remarks

WinGetPos returns negative numbers such as -32000 for minimized windows, but works fine with (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

WinGetClientSize, WinMove

Example

$size = WinGetPos("")
MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])