Show / Hide Table of Contents

Method mouse.leftDown(+ 2 overloads)


Overload

Left down (press and don't release) at position x y relative to window w.

public static MRelease leftDown(wnd w, Coord x = default, Coord y = default, bool nonClient = false)
Parameters
w  (wnd)

Window or control.

x  (Coord)

X coordinate relative to the client area of w. Default - center. Examples: 10, ^10 (reverse), .5f (fraction).

y  (Coord)

Y coordinate relative to the client area of w. Default - center.

nonClient  (bool)

The specified position is relative to the window rectangle, not to its client area.

Returns
MRelease

The return value can be used to auto-release the pressed button. Example: MRelease.

Exceptions
AuWndException
  • The specified position is not in the window (read more in Remarks).
  • Invalid window.
  • The window is hidden. No exception if just cloaked, for example in another desktop; then on click will activate, which usually uncloaks. No exception if w is a control.
  • Other window-related failures.
ArgumentOutOfRangeException

The position is not in screen. No exception if option Relaxed is true (then moves to a screen edge).

AuException

Failed to move the cursor to that position. Some reasons:

  • The active window belongs to a process of higher UAC integrity level.
  • Another thread blocks or modifies mouse input (API BlockInput, mouse hooks, frequent API SendInput etc).
  • Some application called API ClipCursor. No exception if option Relaxed is true (then final cursor position is undefined).
InputDesktopException

Remarks

To move the mouse cursor, calls mouse.move. If after moving the cursor it is not in the window (or a window of its thread), activates the window (or its top-level parent window). Throws exception if then x y is still not in the window. Skips all this when just releasing button or if option Relaxed is true. If w is a control, x y can be somewhere else in its top-level parent window.

Uses opt.mouse: OMouse.MoveSpeed, OMouse.MoveSleepFinally (between moving and clicking), OMouse.ClickSpeed, OMouse.ClickSleepFinally, OMouse.Relaxed.


Overload(next)

Left button down (press and don't release) at position x y.

public static MRelease leftDown(Coord x, Coord y)
Parameters
x  (Coord)

X coordinate in the screen. Examples: 10, ^10 (reverse), .5f (fraction).

y  (Coord)

Y coordinate in the screen.

Returns
MRelease

The return value can be used to auto-release the pressed button. Example: MRelease.

Exceptions
ArgumentOutOfRangeException

The position is not in screen. No exception if option Relaxed is true (then moves to a screen edge).

AuException

Failed to move the cursor to that position. Some reasons:

  • The active window belongs to a process of higher UAC integrity level.
  • Another thread blocks or modifies mouse input (API BlockInput, mouse hooks, frequent API SendInput etc).
  • Some application called API ClipCursor. No exception if option Relaxed is true (then final cursor position is undefined).
InputDesktopException

Remarks

Uses opt.mouse: OMouse.ClickSpeed, OMouse.ClickSleepFinally and those used by mouse.move.


Overload(top)

Left button down (press and don't release).

public static MRelease leftDown(bool useLastXY = false)
Parameters
useLastXY  (bool)

Use mouse.lastXY, not current cursor position. More info: mouse.clickEx.

Returns
MRelease

The return value can be used to auto-release the pressed button. Example: MRelease.

Exceptions
Exception

If lastXYtrue and need to move the cursor - exceptions of mouse.move.

InputDesktopException

Remarks

Uses opt.mouse: OMouse.ClickSpeed, OMouse.ClickSleepFinally and maybe those used by mouse.move.