[New for Windows NT 4.0 Service Pack 3.]
The INPUT structure is used by SendInput to synthesize keystrokes, mouse motions, and button clicks.
typedef struct tagINPUT { DWORD type; union { MOUSEINPUT mi; KEYBDINPUT ki; HARDWAREINPUT hi; }; } INPUT, *PINPUT, FAR* LPINPUT;
Value |
Meaning |
INPUT_MOUSE |
The event is a mouse event. Use the mi structure of the union. |
INPUT_KEYBOARD |
The event is a keyboard event. Use the ki structure of the union. |
INPUT_HARDWARE |
Windows 95 only. The event is from input hardware other than a keyboard or mouse. Use the hi structure of the union. |
typedef struct tagMOUSEINPUT { LONG dx; LONG dy; DWORD mouseData; DWORD dwFlags; DWORD time; DWORD dwExtraInfo; } MOUSEINPUT, *PMOUSEINPUT, FAR* LPMOUSEINPUT;
If dwFlags does not contain MOUSEEVENTF_WHEEL, then mouseData
should be zero.
Value |
Meaning |
MOUSEEVENTF_ABSOLUTE |
Specifies that the dx and dy members contain normalized absolute coordinates. If the flag is not set, the dx and dy members 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 other pointing device, if any, is connected to the system. For further information about relative mouse motion, see the following Remarks section. |
MOUSEEVENTF_MOVE |
Specifies that movement occurred. |
MOUSEEVENTF_LEFTDOWN |
Specifies that the left button was pressed. |
MOUSEEVENTF_LEFTUP |
Specifies that the left button was released. |
MOUSEEVENTF_RIGHTDOWN |
Specifies that the right button was pressed. |
MOUSEEVENTF_RIGHTUP |
Specifies that the right button was released. |
MOUSEEVENTF_MIDDLEDOWN |
Specifies that the middle button was pressed. |
MOUSEEVENTF_MIDDLEUP |
Specifies that the middle button was released. |
MOUSEEVENTF_WHEEL |
Windows NT only: Specifies that the wheel was moved, if the mouse has a wheel. The amount of movement is specified in mouseData. |
The bit flags that specify 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.
typedef struct tagKEYBDINPUT { WORD wVk; WORD wScan; DWORD dwFlags; DWORD time; DWORD dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT, FAR* LPKEYBDINPUT;
Value |
Meaning |
KEYEVENTF_EXTENDEDKEY |
If specified, the scan code was preceded by a prefix byte that has the value 0xE0 (224). |
KEYEVENTF_KEYUP |
If specified, the key is being released. If not specified, the key is being pressed. |
typedef struct tagHARDWAREINPUT { DWORD uMsg; WORD wParamL; WORD wParamH; DWORD dwExtraInfo; } HARDWAREINPUT, *PHARDWAREINPUT, FAR* LPHARDWAREINPUT;
If the mouse has moved, indicated by MOUSEEVENTF_MOVE being set, dx and dy specify information about that motion. The information is given 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; coordinate (65535,65535) maps onto the lower-right corner.
If the MOUSEEVENTF_ABSOLUTE value is not specified, dx and dy specify motions relative to the previous mouse event (the last reported position). Positive values mean the mouse moved right (or down); negative values mean 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 the Control Panel’s Mouse Properties sheet. An application obtains and sets these values with the SystemParametersInfo function.
The operating system applies two tests to the specified relative mouse motion. 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 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 speed 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 specified relative mouse motion along the x or y axis by up to four times.
GetMessageExtraInfo, SendInput, SystemParametersInfo
Questions:
Comments: