示例#1
0
        /// <summary>
        /// Sends shortcut keys (key down and up) signals.
        /// </summary>
        /// <param name="kCode">The array of keys to send as a shortcut.</param>
        /// <param name="delay">The delay in milliseconds between the key down and up events.</param>
        public static void ShortcutKeys(Keys[] kCode, int delay = 0)
        {
            KeyPressStruct KeyPress = new KeyPressStruct(kCode, delay);
            Thread         t        = new Thread(() => KeyPressThread(KeyPress));

            t.Start();
        }
示例#2
0
        /// <summary>
        /// Sends shortcut keys (key down and up) signals.
        /// </summary>
        /// <param name="kCode">The array of keys to send as a shortcut.</param>
        /// <param name="Delay">The delay in milliseconds between the key down and up events.</param>
        /// <remarks></remarks>
        public static void ShortcutKeys(Keys[] kCode, int Delay /*= 0*/)
        {
            KeyPressStruct KeyPress = new KeyPressStruct(kCode, Delay);
            Thread         t        = new Thread(new ParameterizedThreadStart(KeyPressThread));

            t.Start(KeyPress);
        }
示例#3
0
        /// <summary>
        /// Sends a key press signal (key down and up).
        /// </summary>
        /// <param name="kCode">The virtual key code to send.</param>
        /// <param name="delay">The delay to set between the key down and up commands.</param>
        public static void KeyPress(Keys kCode, int delay = 0)
        {
            Keys[]         SendKeys = new[] { kCode };
            KeyPressStruct KeyPress = new KeyPressStruct(SendKeys, delay);
            Thread         t        = new Thread(() => KeyPressThread(KeyPress));

            t.Start();
        }
示例#4
0
        /// <summary>
        /// Sends a key press signal (key down and up).
        /// </summary>
        /// <param name="kCode">The virtual key code to send.</param>
        /// <param name="Delay">The delay to set between the key down and up commands.</param>
        /// <remarks></remarks>
        public static void KeyPress(Keys kCode, int Delay /*= 0*/)
        {
            Keys[]         SendKeys = new Keys[] { kCode };
            KeyPressStruct KeyPress = new KeyPressStruct(SendKeys, Delay);
            Thread         t        = new Thread(new ParameterizedThreadStart(KeyPressThread));

            t.Start(KeyPress);
        }
示例#5
0
        public static void KeyPressThread(object obj)
        {
            KeyPressStruct KeysP = (KeyPressStruct)obj;

            foreach (Keys k in KeysP.Keys)
            {
                KeyDown(k);
            }
            if (KeysP.Delay > 0)
            {
                Thread.Sleep(KeysP.Delay);
            }
            foreach (Keys k in KeysP.Keys)
            {
                KeyUp(k);
            }
        }
示例#6
0
        private static void KeyPressThread(KeyPressStruct keysP)
        {
            foreach (Keys k in keysP.Keys)
            {
                KeyDown(k);
            }

            if (keysP.Delay > 0)
            {
                Thread.Sleep(keysP.Delay);
            }

            foreach (Keys k in keysP.Keys)
            {
                KeyUp(k);
            }
        }
示例#7
0
文件: Input.cs 项目: samiy-xx/keysndr
 /// <summary>
 /// Sends shortcut keys (key down and up) signals.
 /// </summary>
 /// <param name="kCode">The array of keys to send as a shortcut.</param>
 /// <param name="Delay">The delay in milliseconds between the key down and up events.</param>
 /// <remarks></remarks>
 public static void ShortcutKeys(Keys[] kCode, int Delay /*= 0*/)
 {
     KeyPressStruct KeyPress = new KeyPressStruct(kCode, Delay);
     Thread t = new Thread(new ParameterizedThreadStart(KeyPressThread));
     t.Start(KeyPress);
 }
示例#8
0
文件: Input.cs 项目: samiy-xx/keysndr
 /// <summary>
 /// Sends a key press signal (key down and up).
 /// </summary>
 /// <param name="kCode">The virtual key code to send.</param>
 /// <param name="Delay">The delay to set between the key down and up commands.</param>
 /// <remarks></remarks>
 public static void KeyPress(Keys kCode, int Delay /*= 0*/)
 {
     Keys[] SendKeys = new Keys[] { kCode };
     KeyPressStruct KeyPress = new KeyPressStruct(SendKeys, Delay);
     Thread t = new Thread(new ParameterizedThreadStart(KeyPressThread));
     t.Start(KeyPress);
 }