WinGetClientPos
From Auto Hotkey
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
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
Variables in which to store the width and height of the client area. If omitted, the corresponding values will not be stored.
- WinTitle
A window title or other criteria identifying the target window. See WinTitle.
- WinText
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
Windows whose titles include this value will not be considered.
- ExcludeText
Windows whose text include this value will not be considered.
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.
If no matching window is found, the output variables will be made blank.
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
Example
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
}