Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A version of this page is also available for
4/8/2010
This function synthesizes mouse motion and button clicks.
VOID mouse_event(
DWORD dwFlags,
DWORD dx,
DWORD dy,
DWORD dwData,
DWORD dwExtraInfo
);
dwFlags
[in] DWORD that specifies various aspects of mouse motion and button clicking. The following table shows possible values for this parameter, which can be combined.
Value | Description |
---|---|
MOUSEEVENTF_ABSOLUTE |
The dx and dy parameters contain normalized absolute coordinates. If this value is not set, those parameters contain 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 mouse-like device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section. |
MOUSEEVENTF_MOVE |
The user moved the mouse. |
MOUSEEVENTF_LEFTDOWN |
The user pressed the left button. |
MOUSEEVENTF_LEFTUP |
The user released the left button. |
MOUSEEVENTF_RIGHTDOWN |
The user pressed the right button. |
MOUSEEVENTF_RIGHTUP |
The user released the right button. |
MOUSEEVENTF_TOUCH |
The input system treats the event as if it was generated by the touch screen. This in turn will have an effect on the cursor behavior in a dual cursor system. The dx and dy parameters contain normalized absolute coordinates. This flag can not be combined with any other flag. |
MOUSEEVENTF_MIDDLEDOWN |
The user pressed the middle button. |
MOUSEEVENTF_MIDDLEUP |
The user released the middle button. |
MOUSEEVENTF_WHEEL |
The user pressed and released the mouse wheel. |
dwData
[in] DWORD that specifies the type of wheel movement, if dwFlags is MOUSEEVENTF_WHEEL. One wheel click is defined as WHEEL_DELTA, which is 120.
If dwFlags is not MOUSEEVENTF_WHEEL, then dwData should be zero.
None.
If the user moved the mouse, which is indicated by a value of dwFlags that includes MOUSEEVENTF_MOVE, dx and dy hold information about that motion. The information is specified as absolute or relative integer values.
If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain 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, and (65535,65535) maps onto the lower-right corner.
If the MOUSEEVENTF_ABSOLUTE value is not specified, dx and dy specify relative motions from the position reported when the last mouse event was generated. Positive values mean that the user moved the mouse right or down; negative values mean that the user moved the mouse left or up.
Relative mouse motion is subject to the settings for mouse speed and acceleration level. An end user sets these values using the Mouse control panel application. An application obtains and sets these values by using the SystemParametersInfo function.
The system applies two tests to the specified relative mouse motion when applying acceleration. If the specified distance along either the x or y axis is greater than the first mouse threshold value, and the mouse acceleration level is not zero, the operating 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 acceleration level is equal to two, the operating system doubles the distance that resulted from applying the first threshold test. It is thus possible for the operating system to multiply relatively-specified mouse motion along the x or y axis by up to four times.
Once acceleration has been applied, the system scales the resultant value by the desired mouse speed. Mouse speed can range from 1 (slowest) to 20 (fastest) and represents how much the pointer moves based on the distance the mouse moves. The default value is 10, which results in no additional modification to the mouse motion.
Header | windows.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
Please sign in to use this experience.
Sign in