示例#1
0
        public void RunIteration()
        {
            if (lastIteration + new TimeSpan(0, 0, 0, 0, core.MouseUpdateInterval) > DateTime.Now)
                return;

            lastIteration = DateTime.Now;

            if (motionX != 0 || motionY != 0) {
                User32InputHook.INPUT i = new User32InputHook.INPUT();
                i.type = User32InputHook.SendInputEventType.InputMouse;
                i.data.mi.dx = motionX;
                i.data.mi.dy = motionY;
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_MOVE;

                User32InputHook.SendInput(i);
                motionX = motionY = 0;
            }

            if (wheel != 0) {
                User32InputHook.INPUT i = new User32InputHook.INPUT();
                i.type = User32InputHook.SendInputEventType.InputMouse;

                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_WHEEL;
                i.data.mi.mouseData = wheel;

                User32InputHook.SendInput(i);

                wheel = 0;
            }

            ++iteration;
        }
示例#2
0
 private void Move()
 {
     Console.WriteLine("Mouse wheel " + Amount);
     User32InputHook.INPUT i = new User32InputHook.INPUT();
     i.type              = User32InputHook.SendInputEventType.InputMouse;
     i.data.mi.dwFlags   = User32InputHook.MouseEventFlags.MOUSEEVENTF_WHEEL;
     i.data.mi.mouseData = Amount;
     User32InputHook.SendInput(i);
 }
示例#3
0
 private void Move()
 {
     Console.WriteLine("Mouse wheel " + Amount);
     User32InputHook.INPUT i = new User32InputHook.INPUT();
     i.type = User32InputHook.SendInputEventType.InputMouse;
     i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_WHEEL;
     i.data.mi.mouseData = Amount;
     User32InputHook.SendInput(i);
 }
示例#4
0
        public override void Release()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type = User32InputHook.SendInputEventType.InputMouse;

            if (Button == Buttons.Left)
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_LEFTUP;
            else if (Button == Buttons.Right)
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_RIGHTUP;
            else if (Button == Buttons.Middle)
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_MIDDLEUP;

            User32InputHook.SendInput(i);
        }
示例#5
0
        public override void Press()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type = User32InputHook.SendInputEventType.InputMouse;

            if (Button == Buttons.Left)
            {
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_LEFTDOWN;
            }
            else if (Button == Buttons.Right)
            {
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_RIGHTDOWN;
            }
            else if (Button == Buttons.Middle)
            {
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_MIDDLEDOWN;
            }

            User32InputHook.SendInput(i);
        }
示例#6
0
        private void OnPress()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type                = User32InputHook.SendInputEventType.InputKeyboard;
            i.data.ki.wScan       = 0;
            i.data.ki.time        = 0;
            i.data.ki.dwFlags     = 0;
            i.data.ki.dwExtraInfo = IntPtr.Zero;

            // Press modifiers
            foreach (User32InputHook.VK mod in VModifiers)
            {
                i.data.ki.wVk = (ushort)mod;
                User32InputHook.SendInput(i);
            }

            i.data.ki.wVk = (ushort)VKey;
            if ((i.data.ki.wVk >= 33 && i.data.ki.wVk <= 46) || (i.data.ki.wVk >= 91 && i.data.ki.wVk <= 93))
            {
                i.data.ki.dwFlags += User32InputHook.KEYEVENTF_EXTENDEDKEY;
            }
            User32InputHook.SendInput(i);
        }
示例#7
0
        public override void Release()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type                = User32InputHook.SendInputEventType.InputKeyboard;
            i.data.ki.wScan       = 0;
            i.data.ki.time        = 0;
            i.data.ki.dwFlags     = 2;
            i.data.ki.dwExtraInfo = IntPtr.Zero;
            i.data.ki.wVk         = (ushort)VKey;
            if ((i.data.ki.wVk >= 33 && i.data.ki.wVk <= 46) || (i.data.ki.wVk >= 91 && i.data.ki.wVk <= 93))
            {
                i.data.ki.dwFlags |= User32InputHook.KEYEVENTF_EXTENDEDKEY;
            }
            User32InputHook.SendInput(i);

            i.data.ki.dwFlags = 2;
            // Release modifiers
            foreach (User32InputHook.VK mod in VModifiers)
            {
                i.data.ki.wVk = (ushort)mod;
                User32InputHook.SendInput(i);
            }
        }
示例#8
0
        public void RunIteration()
        {
            if (lastIteration + new TimeSpan(0, 0, 0, 0, core.MouseUpdateInterval) > DateTime.Now)
            {
                return;
            }

            lastIteration = DateTime.Now;

            if (motionX != 0 || motionY != 0)
            {
                User32InputHook.INPUT i = new User32InputHook.INPUT();
                i.type            = User32InputHook.SendInputEventType.InputMouse;
                i.data.mi.dx      = motionX;
                i.data.mi.dy      = motionY;
                i.data.mi.dwFlags = User32InputHook.MouseEventFlags.MOUSEEVENTF_MOVE;

                User32InputHook.SendInput(i);
                motionX = motionY = 0;
            }

            if (wheel != 0)
            {
                User32InputHook.INPUT i = new User32InputHook.INPUT();
                i.type = User32InputHook.SendInputEventType.InputMouse;

                i.data.mi.dwFlags   = User32InputHook.MouseEventFlags.MOUSEEVENTF_WHEEL;
                i.data.mi.mouseData = wheel;

                User32InputHook.SendInput(i);

                wheel = 0;
            }

            ++iteration;
        }
示例#9
0
        private void OnPress()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type = User32InputHook.SendInputEventType.InputKeyboard;
            i.data.ki.wScan = 0;
            i.data.ki.time = 0;
            i.data.ki.dwFlags = 0;
            i.data.ki.dwExtraInfo = IntPtr.Zero;

            // Press modifiers
            foreach (User32InputHook.VK mod in VModifiers) {
                i.data.ki.wVk = (ushort)mod;
                User32InputHook.SendInput(i);
            }

            i.data.ki.wVk = (ushort)VKey;
            if ((i.data.ki.wVk >= 33 && i.data.ki.wVk <= 46) || (i.data.ki.wVk >= 91 && i.data.ki.wVk <= 93))
                i.data.ki.dwFlags += User32InputHook.KEYEVENTF_EXTENDEDKEY;
            User32InputHook.SendInput(i);
        }
示例#10
0
        public override void Release()
        {
            User32InputHook.INPUT i = new User32InputHook.INPUT();
            i.type = User32InputHook.SendInputEventType.InputKeyboard;
            i.data.ki.wScan = 0;
            i.data.ki.time = 0;
            i.data.ki.dwFlags = 2;
            i.data.ki.dwExtraInfo = IntPtr.Zero;
            i.data.ki.wVk = (ushort)VKey;
            if ((i.data.ki.wVk >= 33 && i.data.ki.wVk <= 46) || (i.data.ki.wVk >= 91 && i.data.ki.wVk <= 93))
                i.data.ki.dwFlags |= User32InputHook.KEYEVENTF_EXTENDEDKEY;
            User32InputHook.SendInput(i);

            i.data.ki.dwFlags = 2;
            // Release modifiers
            foreach (User32InputHook.VK mod in VModifiers) {
                i.data.ki.wVk = (ushort)mod;
                User32InputHook.SendInput(i);
            }
        }