Ejemplo n.º 1
0
        internal void MouseWheel(bool up)
        {
            var mouseInput = new Win32.MOUSEINPUT();

            mouseInput.dwFlags = Win32.MOUSEEVENTF.WHEEL;

            if (up)
            {
                mouseInput.mouseData = 120;
            }
            else
            {
                mouseInput.mouseData = -120;
            }

            var inputunion = new Win32.InputUnion();

            inputunion.mi = mouseInput;

            var input = new Win32.INPUT();

            input.type = (uint)Win32.InputTypes.INPUT_MOUSE;
            input.U    = inputunion;

            Win32.INPUT[] inputs = { input };

            Win32.SendInput((uint)inputs.Length, inputs, Win32.INPUT.Size);
        }
Ejemplo n.º 2
0
        internal void PressKey(Win32.ScanCodeShort scanCode, Win32.VirtualKeyShort virtualKey)
        {
            var keybInput = new Win32.KEYBDINPUT();

            keybInput.wScan = scanCode;
            keybInput.wVk   = virtualKey;

            var inputunion = new Win32.InputUnion();

            inputunion.ki = keybInput;

            var input = new Win32.INPUT();

            input.type = (uint)Win32.InputTypes.INPUT_KEYBOARD;
            input.U    = inputunion;

            Win32.INPUT[] inputs = { input };

            Win32.SendInput((uint)inputs.Length, inputs, Win32.INPUT.Size);
        }
Ejemplo n.º 3
0
        internal void MouseLeftUp()
        {
            var mouseInput = new Win32.MOUSEINPUT();

            mouseInput.dwFlags = Win32.MOUSEEVENTF.LEFTUP;

            mouseInput.mouseData = 0;

            var inputunion = new Win32.InputUnion();

            inputunion.mi = mouseInput;

            var input = new Win32.INPUT();

            input.type = (uint)Win32.InputTypes.INPUT_MOUSE;
            input.U    = inputunion;

            Win32.INPUT[] inputs = { input };

            Win32.SendInput((uint)inputs.Length, inputs, Win32.INPUT.Size);
        }
Ejemplo n.º 4
0
        internal void MoveMouse()
        {
            var mouseInput = new Win32.MOUSEINPUT();

            mouseInput.dx      = (int)mousePosition.X;
            mouseInput.dy      = -(int)mousePosition.Y;
            mouseInput.dwFlags = Win32.MOUSEEVENTF.MOVE;

            var inputunion = new Win32.InputUnion();

            inputunion.mi = mouseInput;

            var input = new Win32.INPUT();

            input.type = (uint)Win32.InputTypes.INPUT_MOUSE;
            input.U    = inputunion;

            Win32.INPUT[] inputs = { input };

            Win32.SendInput((uint)inputs.Length, inputs, Win32.INPUT.Size);
        }