C# Simulate MousewheelUp and Down with exact values

0

i use the method below to move the mouse wheel up and down but sometimes when i call this function the amount it scrolls up is different sometimes its scrolls higher other times it barley scrolls i was wondering if there was a different way to simulate scrolling up and down where it is always the same amount.

static extern void mouse_event(uint dwFlags, int dx, int dy, int dwData, int dwExtraInfo);

    public enum MouseEventFlags : uint
    {
        LEFTDOWN = 0x00000002,
        LEFTUP = 0x00000004,
        MIDDLEDOWN = 0x00000020,
        MIDDLEUP = 0x00000040,
        MOVE = 0x00000001,
        ABSOLUTE = 0x00008000,
        RIGHTDOWN = 0x00000008,
        RIGHTUP = 0x00000010,
        WHEEL = 0x00000800,
        XDOWN = 0x00000080,
        XUP = 0x00000100
    }
    public static void MouseWheelUp()
    {
        mouse_event((uint)MouseEventFlags.WHEEL, 0, 0, 120, 0);
    }

Edit: fixed wrong code

c#
asked on Stack Overflow Jul 18, 2019 by DanA • edited Jul 18, 2019 by DanA

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0