I use the following code:
private const int MOUSEEVENTF_WHEEL = 0x0800;
public void MouseWheelUp()
{
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 120, 0);
}
But how do I make it work for scrolling down?
function signature:
VOID WINAPI mouse_event(
_In_ DWORD dwFlags,
_In_ DWORD dx,
_In_ DWORD dy,
_In_ DWORD dwData,
_In_ ULONG_PTR dwExtraInfo
);
If
dwFlags
containsMOUSEEVENTF_WHEEL
, thendwData
specifies 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 asWHEEL_DELTA
, which is 120.
To scroll down :
mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -120, 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.