# 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 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 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.

## 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:
  `{FD443EC1-0006-4F5B-9282-D72760A66916}`

## Member Function Documentation

void IMouse::putMouseEvent | ( | in long | dx,
|  | in long | dy,
|  | in long | dz,
|  | 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.
  | 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 | 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.
  | 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:
  VirtualBox Guest Tools need to be installed to the guest OS in order to enable absolute mouse positioning support. You can use the IConsoleCallback::onMouseCapabilityChange callback to be instantly informed about changes of this attribute during virtual machine execution.

See also:
  putMouseEventAbsolute