Get cursor (mouse pointer) position

Syntax

int xm([pp] [window] [client])
int ym([pp] [window] [client])

 

Parameters

pp - variable of type POINT. If used, each function also stores x and y coordinates into this variable. Default: 0.

window - top-level or child window. If omitted or literal 0, coordinates are relative to the top-left corner of the screen.

client - if 1, coordinates are relative to the top-left corner of window's client area or, if window is literal 0, the work area. Default: 0.

 

Remarks

Function xm returns cursor x position in pixels, ym - y position. To get x and y in one call, use pp with either function.

 

The POINT type is used to specify coordinates.

 

type POINT x y

 

Examples

int x = xm

lef 100 ym(0 "Notepad") "Notepad"
 
POINT p
xm p "Quick"
out "Cursor coordinates relative to window ''Quick'' are:[]x=%i y=%i" p.x p.y