Skip to main content
Version: 20 R7 BETA

GET WINDOW RECT

GET WINDOW RECT ( left ; top ; right ; bottom {; window} )

ParameterTypeDescription
leftIntegerLeft coordinate of window's contents area
topIntegerTop coordinate of window's contents area
rightIntegerRight coordinate of window's contents area
bottomIntegerBottom coordinate of window's contents area
windowIntegerWindow reference number, or Frontmost window of current process, if omitted or MDI window if -1 (Windows)

This command is not thread-safe, it cannot be used in preemptive code.

Description

The GET WINDOW RECT command returns the coordinates of the window whose reference number is passed in window. If the window does not exist, the variable parameters are left unchanged.

If you omit the window parameter, GET WINDOW RECT applies to the frontmost window for the current process.

The coordinates are expressed relative to the top left corner of the contents area of the application window (Windows MDI mode) or to the main screen (macOS and Windows SDI mode). The coordinates return the rectangle corresponding to the contents area of the window (excluding title bars and borders).

Note: Under Windows, if you pass -1 in window, GET WINDOW RECT returns the coordinates of the application window (MDI window). These coordinates correspond to the contents area of the window (excluding menu bars and borders). In this case in SDI mode, GET WINDOW RECT returns (0;0;0;0) as coordinates.

Example

See example for the WINDOW LIST command.

See also

CONVERT COORDINATES
SET WINDOW RECT