Change window position or size

Syntax

mov left top [window] [flags]
siz width height [window] [flags]
mov+ left top width height [window] [flags]

 

Parameters

left, top - new coordinates of top-left corner.

width, height - new width and height.

window - top-level or child window.

flags:

1 Don't change left (with mov and mov+) or width (with siz).
2 Don't change top (with mov and mov+) or height (with siz).
4 Coordinates are relative to the work area. Only with top-level windows.
0x100, 0x200 QM 2.3.6. Don't change width or height when used with mov+.

 

Remarks

mov changes window position.

siz changes window dimensions.

mov+ changes window position and dimensions. Added in QM 2.3.6.

 

If window is omitted or "", uses the active window.

 

Coordinates must be relative to the primary monitor. If you want to use coordinates relative to some other monitor, use function XyMonitorToNormal to convert them.

 

If it is child window (control), coordinates must be relative to the client area of its direct parent window.

 

If width and/or height is a double number, it is interpreted as fraction of screen (if top-level window) or fraction of client area of direct parent window (if control). See examples. Integer numbers are pixels.

 

Window position and size will not be changed if it is minimized. Also you should not change it if the window is maximized. To ensure that Notepad window is not minimized and not maximized, use this code:

 

int w2=win("Notepad")
if(min(w2)) res w2
if(max(w2)) res w2

 

The speed depends on spe.

 

There are more functions to move or resize windows:

To get help, type or click function name and press F1. Note that these functions don't accept window name. Use window handle. Use function win, child or id to get handle. Also, they accept only integer coordinates.

 

Examples

mov 500 0 "Notepad" ;;move "Notepad" to 500 0 pixels
mov 0.5 0.5 "Notepad" ;;move "Notepad" to the middle
siz 300 200 "Notepad" ;;change "Notepad" size
siz 1.0 0.25 "Notepad" ;;change "Notepad" size. Width will be screen width, height 0.25 of screen height
mov+ 100 100 400 400 win("Notepad") ;;move-resize window