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?
mouse_event function
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With