WinGetClientPos

Retrieves the position and size of the specified window's client area.

WinGetClientPos X, Y, Width, Height, WinTitle, WinText, ExcludeTitle, ExcludeText

Parameters

X, Y

Type: Variable

Variables in which to store the X and Y coordinates of the client area's upper left corner. If omitted, the corresponding values will not be stored.

Width, Height

Type: Variable

Variables in which to store the width and height of the client area. If omitted, the corresponding values will not be stored.

WinTitle

Type: String, Integer or Object

A window title or other criteria identifying the target window. See WinTitle.

WinText

Type: String

If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.

ExcludeTitle

Type: String

Windows whose titles include this value will not be considered.

ExcludeText

Type: String

Windows whose text include this value will not be considered.

Error Handling

An exception is thrown if the window could not be found.

Remarks

The client area is the part of the window which can contain controls. It excludes the window's title bar, menu (if it has a standard one) and borders. The position and size of the client area are less dependent on OS version and theme than the values returned by WinGetPos.

The values returned for a minimized window may vary depending on OS and configuration, but are usually -32000 for the X and Y coordinates and zero for the width and height.

Related

WinGetPos, WinMove, ControlGetPos, WinGetTitle, WinGetText, ControlGetText

Examples

#1

WinGetClientPos X, Y, W, H, "Calculator"
MsgBox "Calculator's client area is at " X "," Y " and its size is " W "x" H

WinGetClientPos X, Y,,, "A"  ; "A" to get the active window's pos.
MsgBox "The active window's client area is at " X "," Y

if WinExist("Untitled - Notepad")
{
    WinGetClientPos Xpos, Ypos  ; Uses the window found above.
    MsgBox "Notepad's client area is at " Xpos "," Ypos
}