Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This structure contains information about a simulated mouse event.

Syntax

typedef struct tagMOUSEINPUT {
  LONG 
dx;
  LONG 
dy;
  DWORD 
mouseData;
  DWORD 
dwFlags;
  DWORD 
time;
  ULONG_PTR 
dwExtraInfo;
} MOUSEINPUT, *PMOUSEINPUT;

Members

dx

Provides the absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlagsmember. Absolute data is provided as the x coordinate of the mouse; relative data is provided as the number of pixels moved.

dy

Provides the absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlagsmember. Absolute data is provided as the y coordinate of the mouse; relative data is provided as the number of pixels moved.

mouseData

If dwFlagscontains MOUSEEVENTF_WHEEL, then mouseDataprovides the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120.

If dwFlagsdoes not contain MOUSEEVENTF_WHEEL then mouseDatashould be zero.

dwFlags

Set of bit flags that indicate various aspects of mouse motion and button clicks. The bits in this member can be any reasonable combination of the following values.

Flag Description

MOUSEEVENTF_ABSOLUTE

Indicates that the dxand dymembers contain normalized absolute coordinates. If the flag is not set, then dxand dycontain relative data, the change in position since the last reported position. This flag can be set, or not set, regardless of what kind of mouse or other pointing device, if any, is connected to the system. For further information about relative mouse motion, see the Remarks section.

MOUSEEVENTF_MOVE

Indicates that movement occurred.

MOUSEEVENTF_LEFTDOWN

Indicates that the left button was pressed.

MOUSEEVENTF_LEFTUP

Indicates that the left button was released.

MOUSEEVENTF_RIGHTDOWN

Indicates that the right button was pressed.

MOUSEEVENTF_RIGHTUP

Indicates that the right button was released.

MOUSEEVENTF_MIDDLEDOWN

Indicates that the middle button was pressed.

MOUSEEVENTF_MIDDLEUP

Indicates that the middle button was released.

MOUSEEVENTF_VIRTUALDESK

Not supported.

MOUSEEVENTF_WHEEL

If the mouse has a wheel, then this indicates that the wheel was moved. The amount of movement is provided in mouseData.

MOUSEEVENTF_XDOWN

Not supported.

MOUSEEVENTF_XUP

Not supported.

The bit flags that provide mouse button status are set to indicate changes in status, not ongoing conditions. For example, if the left mouse button is pressed and held down, MOUSEEVENTF_LEFTDOWN is set when the left button is first pressed, but not for subsequent motions. Similarly, MOUSEEVENTF_LEFTUP is set only when the button is first released.

time

Time stamp for the event, in milliseconds. If this parameter is 0, the system will provide its own time stamp.

dwExtraInfo

Data in this member is ignored.

Remarks

If the mouse has moved, as indicated by MOUSEEVENTF_MOVE, then dxand dyprovide information about that movement. The information is provided as absolute or relative integer values.

If MOUSEEVENTF_ABSOLUTE value is specified, then dxand dycontain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface; coordinate (65535,65535) maps onto the lower-right corner.

If the MOUSEEVENTF_ABSOLUTE value is not specified, then dxand dyprovide movement differences relative to the previous mouse event, which is the last reported position. Positive values indicate that the mouse moved right (or down); negative values indicate that the mouse moved left (or up).

Relative mouse motion is subject to the effects of the mouse speed and the two-mouse threshold values. A user sets these three values with the Pointer Speed slider of Control Panel's Mouse Properties sheet. You can obtain and set these values using the SystemParametersInfofunction.

The system applies two tests to the specified relative mouse movement. If the specified distance along either the x- or y-axis is greater than the first mouse threshold value, and the mouse speed is not zero, the system doubles the distance. If the specified distance along either the x- or y-axis is greater than the second mouse threshold value, and the mouse speed is equal to two, the system doubles the distance that resulted from applying the first threshold test. It is thus possible for the system to multiply specified relative mouse movement along the x- or y-axis by up to four times.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also