# IMouse Interface Reference

The IMouse interface represents the virtual machine's mouse. More...

List of all members.

## Public Member Functions
void | putMouseEvent (in long dx, in long dy, in long dz, in long dw, in long buttonState)
| Initiates a mouse event using relative pointer movements along x and y axis.
void | putMouseEventAbsolute (in long x, in long y, in long dz, in long dw, in long buttonState)
| Positions the mouse pointer using absolute x and y coordinates.
## Public Attributes
readonly attribute boolean | absoluteSupported
| Whether the guest OS supports absolute mouse pointer positioning or not.
readonly attribute boolean | relativeSupported
| Whether the guest OS supports relative mouse pointer positioning or not.
readonly attribute boolean | needsHostCursor
| Whether the guest OS can currently switch to drawing it's own mouse cursor on demand.

## Detailed Description

The IMouse interface represents the virtual machine's mouse.

Used in IConsole::mouse.

Through this interface, the virtual machine's virtual mouse can be controlled.

Interface ID:
  `{7C0F2EAE-F92D-498C-B802-E1A3763774DC}`

## Member Function Documentation

void IMouse::putMouseEvent | ( | in long | dx,
|  | in long | dy,
|  | in long | dz,
|  | in long | dw,
|  | in long | buttonState |
| ) |  |  |

Initiates a mouse event using relative pointer movements along x and y axis.

Parameters:

  | dx | Amount of pixels the mouse should move to the right. Negative values move the mouse to the left.
  | dy | Amount of pixels the mouse should move downwards. Negative values move the mouse upwards.
  | dz | Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations.
  | dw | Amount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right.
  | buttonState | The current state of mouse buttons. Every bit represents a mouse button as follows:
  Bit 0 (`0x01`) | left mouse button
  Bit 1 (`0x02`) | right mouse button
  Bit 2 (`0x04`) | middle mouse button
  A value of `1` means the corresponding button is pressed. otherwise it is released.

Expected result codes:

  E_ACCESSDENIED | Console not powered up.
  VBOX_E_IPRT_ERROR | Could not send mouse event to virtual mouse.

void IMouse::putMouseEventAbsolute | ( | in long | x,
|  | in long | y,
|  | in long | dz,
|  | in long | dw,
|  | in long | buttonState |
| ) |  |  |

Positions the mouse pointer using absolute x and y coordinates.

These coordinates are expressed in pixels and start from `[1,1]` which corresponds to the top left corner of the virtual display.

Parameters:

  | x | X coordinate of the pointer in pixels, starting from `1`.
  | y | Y coordinate of the pointer in pixels, starting from `1`.
  | dz | Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations.
  | dw | Amount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right.
  | buttonState | The current state of mouse buttons. Every bit represents a mouse button as follows:
  Bit 0 (`0x01`) | left mouse button
  Bit 1 (`0x02`) | right mouse button
  Bit 2 (`0x04`) | middle mouse button
  A value of `1` means the corresponding button is pressed. otherwise it is released.

Expected result codes:

  E_ACCESSDENIED | Console not powered up.
  VBOX_E_IPRT_ERROR | Could not send mouse event to virtual mouse.

Note:
  This method will have effect only if absolute mouse positioning is supported by the guest OS.

See also:
  absoluteSupported

## Member Data Documentation

readonly attribute boolean IMouse::absoluteSupported

Whether the guest OS supports absolute mouse pointer positioning or not.

Note:
  You can use the IConsoleCallback::onMouseCapabilityChange callback to be instantly informed about changes of this attribute during virtual machine execution.

See also:
  putMouseEventAbsolute

readonly attribute boolean IMouse::relativeSupported

Whether the guest OS supports relative mouse pointer positioning or not.

Note:
  You can use the IConsoleCallback::onMouseCapabilityChange callback to be instantly informed about changes of this attribute during virtual machine execution.

See also:
  putMouseEvent

readonly attribute boolean IMouse::needsHostCursor

Whether the guest OS can currently switch to drawing it's own mouse cursor on demand.

Note:
  You can use the IConsoleCallback::onMouseCapabilityChange callback to be instantly informed about changes of this attribute during virtual machine execution.

See also:
  putMouseEvent