Exemple #1
0
        public InputBuilder AddKeyUp(Keys key)
        {
            var up = new INPUT
            {
                Type = INPUT.InputType.Keyboard,
                Keyboard = new KEYBDINPUT
                {
                    VirtualKey = (short) ((int) key & 0xff),
                    ScanCode = 0,
                    Flags = KeyboardFlags.KeyUp,
                    TimeStamp = 0,
                    ExtraInfo = IntPtr.Zero
                }
            };

            _inputs.Add(up);
            return this;
        }
 private void AssertIsKeyUpInputFor(Keys key, INPUT input)
 {
     Assert.AreEqual(input.Type, INPUT.InputType.Keyboard);
     Assert.AreEqual(input.Keyboard.VirtualKey, (int) key & 0xff);
     Assert.AreEqual(input.Keyboard.Flags, KeyboardFlags.KeyUp);
 }
 private void AssertIsKeyDownInputFor(Keys key, INPUT input)
 {
     int virtualKey = (int) key & 0xff;
     Assert.AreEqual(input.Type, INPUT.InputType.Keyboard);
     Assert.AreEqual(input.Keyboard.VirtualKey, virtualKey);
     Assert.AreEqual(input.Keyboard.Flags, KeyboardFlags.None);
 }
 private static extern int SendInput(int inputNumber, INPUT[] inputs, int size);