Share via


mouse_event

This function synthesizes mouse motion and button clicks.

VOID mouse_event(
  DWORD dwFlags, 
  DWORD dx, 
  DWORD dy, 
  DWORD dwData, 
  DWORD dwExtraInfo 
);

Parameters

  • 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_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.
  • dx
    [in] DWORD that specifies the absolute position of the mouse along the x-axis or the amount of motion of the mouse since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is specified as the actual x-coordinate of the mouse; relative data is specified as the number of mickeys moved. A mickey is the amount that a mouse has to move for the mouse to report that it has moved.

  • dy
    [in] DWORD that specifies the absolute position of the mouse along the y-axis or the amount of motion of the mouse since the last mouse event was generated, depending on the setting of MOUSEEVENTF_ABSOLUTE. Absolute data is specified as the actual y-coordinate of the mouse; relative data is specified as the number of mickeys moved.

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

  • dwExtraInfo
    Unsupported.

Return Values

None.

Remarks

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.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Windows.h.
Link Library: Coredll.lib.

See Also

SystemParametersInfo

 Last updated on Wednesday, April 14, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.