MouseInfo

Returns assorted mouse information.

Syntax:

MouseInfo (request#)

Parameters:

(i) request# see below.

Returns:

(s)  see below.

 

The information returned by MouseInfo depends on the value of request#.

Request#

Return Value

0

Window name under mouse

1

Top level parent window name under mouse

2

Mouse coordinates, assuming a 1000x1000 virtual screen

3

Mouse coordinates in absolute numbers

4

Status of mouse buttons, as a bitmask:

Binary Decimal Meaning

000 0 No buttons down
001 1 Right button down
010 2 Middle button down
011 3 Right and Middle buttons down
100 4 Left button down
101 5 Left and Right buttons down
110 6 Left and Middle buttons down
111 7 Left, Middle, and Right buttons down

5

Mouse coordinates relative to the client area of the window under the cursor, in virtual (1000x1000) screen units.

6

Mouse coordinates relative to the client area of the window under the cursor, in virtual (1000x1000) client units.

7

Mouse coordinates relative to the bounding rectangle of the window under the cursor, in virtual (1000x1000) screen units.

8

Synchronous status of mouse buttons, as a bitmask. This is like request #4, except #8 returns the asynchronous (current) state of the buttons, whereas #4 returns the state at the time the function was called.

9

Window ID of top level parent window under mouse.

10

Similar to request 0 except that the request can also return the window name of static, hidden and disabled child windows that have a caption. Examples of static windows include WIL Dialog VARYTEXT, STATICTEXT and PICTURE controls.

 

 

For example, if mouse is at the center of a 640x480 screen and above the "Clock" window, and the left button is down, the following values would be returned:

Request#

Return Value

0

"Clock"

1

"Clock"

2

"500 500"

3

"320 240"

4

"4"

 

Note: The size and shape of displayed windows are usually based on a combination of screen resolution and the system font size. Thus the x and y coordinates may be different on each individual machine.

Example:


Display(1, "", "Press a mouse button to continue")
buttons = 0
While buttons == 0
   buttons = MouseInfo(4)
EndWhile
If buttons & 4
   Display(1, "", "Left button was pressed")
EndIf
If buttons & 1
   Display(1, "", "Right button was pressed")
EndIf
See Also:

SysParamInfo, WinMetrics, MouseClick, MouseClickBtn, MouseMove