Esempio n. 1
0
 public void AbsoluteMove(int x, int y) {
     var inputBuffer = new INPUT {type = 0U};
     inputBuffer.inputData.mi.dwFlags = 32769U;
     inputBuffer.inputData.mi.dx = (int)(ushort.MaxValue * (double)x / desktopWidth);
     inputBuffer.inputData.mi.dy = (int)(ushort.MaxValue * (double)y / desktopHeight);
     User32.SendInput(1U, new[] {inputBuffer}, Marshal.SizeOf(typeof(INPUT)));
 }
Esempio n. 2
0
        public void WheelUp() {
            var inputBuffer = new INPUT {type = 0U};
            inputBuffer.inputData.mi.dwFlags = 2048U;
            inputBuffer.inputData.mi.mouseData = (uint)WheelSpeed;

            User32.SendInput(1U, new[] {inputBuffer}, Marshal.SizeOf(typeof(INPUT)));
        }
Esempio n. 3
0
        /// <summary>
        ///     Writes down the characters as if it was through the keyboard.
        /// </summary>
        public void Write(params char[] chars) {
            var input = new INPUT[chars.Length];
            for (int i = 0; i < input.Length; i++) {
                input[i] = new INPUT {type = 1};
                input[i].inputData.ki.wVk = 0;
                input[i].inputData.ki.wScan = @chars[i];
                input[i].inputData.ki.time = 0;
                input[i].inputData.ki.dwFlags = (uint) Win32Interop.Enums.KEYEVENTF.KEYEVENTF_UNICODE;
                input[i].inputData.ki.dwExtraInfo = 0;
            }

            User32.SendInput((uint) input.Length, input, Marshal.SizeOf(typeof(INPUT)));
        }
Esempio n. 4
0
        public void MiddleUp() {
            var inputBuffer = new INPUT {type = 0U};
            inputBuffer.inputData.mi.dwFlags = 64U;

            User32.SendInput(1U, new[] {inputBuffer}, Marshal.SizeOf(typeof(INPUT)));
        }
Esempio n. 5
0
 public void Up(KeyCode keycode) {
     var inputBuffer = new INPUT {
         type = 1U,
         inputData = {
             ki = new KEYBDINPUT {
                 wVk = (ushort) keycode,
                 wScan = this.Convert(keycode),
                 dwFlags = this.IsExtendedKey(keycode) ? 3U : 2U,
                 time = 0U,
                 dwExtraInfo = 0
             }
         }
     };
     User32.SendInput(1U, new[] {inputBuffer}, Marshal.SizeOf(typeof(INPUT)));
 }