Example #1
0
        public InputCapture(ClientSession client)
        {
            this.client = client;
            this.input = new Input();

            input.KeyboardFilterMode = KeyboardFilterMode.All;

            input.Load();

            input.OnKeyPressed += new EventHandler<KeyPressedEventArgs>(OnKeyPressed);
        }
Example #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            reg_hotkey(); // 注册热键

            input = new icp.Input();
            input.KeyPressDelay = 2;

            // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
            // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
            input.KeyboardFilterMode = icp.KeyboardFilterMode.All;
            // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

            // Finally, load the driver
            input.Load();
        }
        //play/pause
        static void commandOne()
        {
            Input input = new Input();

            // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
            // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
            input.KeyboardFilterMode = KeyboardFilterMode.All;
            // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

            // Finally, load the driver
            input.Load();
            Microsoft.VisualBasic.Interaction.AppActivate("Untitled - Notepad");

            input.MoveMouseTo(5, 5);
            input.MoveMouseBy(25, 25);
            input.SendLeftClick();

            input.KeyDelay = 1; // See below for explanation; not necessary in non-game apps
            input.SendKeys(Keys.Enter);  // Presses the ENTER key down and then up (this constitutes a key press)

            // Or you can do the same thing above using these two lines of code
            input.SendKeys(Keys.Enter, KeyState.Down);
            System.Threading.Thread.Sleep(1); // For use in games, be sure to sleep the thread so the game can capture all events. A lagging game cannot process input quickly, and you so you may have to adjust this to as much as 40 millisecond delay. Outside of a game, a delay of even 0 milliseconds can work (instant key presses).
            input.SendKeys(Keys.Enter, KeyState.Up);

            input.SendText("hello, I am typing!");

            /* All these following characters / numbers / symbols work */
            input.SendText("abcdefghijklmnopqrstuvwxyz");
            input.SendText("1234567890");
            input.SendText("!@#$%^&*()");
            input.SendText("[]\\;',./");
            input.SendText("{}|:\"<>?");

            // And finally
            input.Unload();
        }
Example #4
0
        protected override void OnThreadStart()
        {
            this.input = new Input();

            // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
            // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
            input.KeyboardFilterMode = KeyboardFilterMode.All;
            // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

            // Finally, load the driver
            input.Load();
        }