# MOUSE_EVENT_RECORD

The MOUSE_EVENT_RECORD structure is used in a console INPUT_RECORD structure to report mouse input events.

    typedef struct _MOUSE_EVENT_RECORD {
        COORD dwMousePosition;
        DWORD dwButtonState;
        DWORD dwControlKeyState;
        DWORD dwEventFlags;
    } MOUSE_EVENT_RECORD;

### Members

dwMousePosition
Location of the cursor, in terms of the screen buffer's character-cell coordinates (see COORD structure).
dwButtonState
Indicates the status of the mouse buttons. The least significant bit corresponds to the leftmost mouse button. The next least significant bit corresponds to the rightmost mouse button. The next bit indicates the next-to-leftmost mouse button. The bits then correspond left to right to the mouse buttons. A bit is 1 if the button was pressed.
The following constants are defined for the first five mouse buttons:
FROM_LEFT_1ST_BUTTON_PRESSED
RIGHTMOST_BUTTON_PRESSED
FROM_LEFT_2ND_BUTTON_PRESSED
FROM_LEFT_3RD_BUTTON_PRESSED
FROM_LEFT_4TH_BUTTON_PRESSED
dwControlKeyState
Indicates the state of the control keys. This member can be one or more of the following values.

Value | Description
--- | ---
CAPSLOCK_ON | The CAPS LOCK light is on.
ENHANCED_KEY | The key is enhanced.
LEFT_ALT_PRESSED | The left ALT key is pressed.
LEFT_CTRL_PRESSED | The left CTRL key is pressed.
NUMLOCK_ON | The NUM LOCK light is on.
RIGHT_ALT_PRESSED | The right ALT key is pressed.
RIGHT_CTRL_PRESSED | The right CTRL key is pressed.
SCROLLLOCK_ON | The SCROLL LOCK light is on.
SHIFT_PRESSED | The SHIFT key is pressed.

dwEventFlags
Indicates the type of mouse event. If this value is zero, it indicates a mouse button being pressed or released. Otherwise, this member is one of the following values.

Value | Description
--- | ---
DOUBLE_CLICK | The second click (button press) of a double-click occurred. The first click is returned as a regular button-press event.
MOUSE_MOVED | A change in mouse position occurred.
MOUSE_WHEELED | Windows 2000/XP/2003/Vista/2008/7: The vertical mouse wheel was moved. If this flag is set, high word of dwButtonState indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA.
MOUSE_HWHEELED | Windows Vista/2008/7: The horizontal mouse wheel was moved. If this flag is set, high word of dwButtonState indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA.

### Remarks

Mouse events are placed in the input buffer when the console is in mouse mode (ENABLE_MOUSE_INPUT).
Mouse events are generated whenever the user moves the mouse, or presses or releases one of the mouse buttons. Mouse events are placed in the console input buffer only when the console group has the keyboard focus and the cursor is within the borders of the console window.
See also:
COORD, PeekConsoleInput, ReadConsoleInput, WriteConsoleInput, INPUT_RECORD