Пример #1
0
 private static VirtualKeyboard.INPUT CreateInput(Keys key, bool bDown)
 {
     VirtualKeyboard.INPUT result = default(VirtualKeyboard.INPUT);
     result.type           = 1;
     result.ki.wVk         = (short)key;
     result.ki.wScan       = (short)VirtualKeyboard.MapVirtualKey((int)result.ki.wVk, 0);
     result.ki.dwFlags     = (1 | (bDown ? 0 : 2));
     result.ki.dwExtraInfo = 0;
     result.ki.time        = 0;
     return(result);
 }
Пример #2
0
 public static void SendKeyEnter(int KeyInterval = 20)
 {
     VirtualKeyboard.INPUT[] array = new VirtualKeyboard.INPUT[]
     {
         VirtualKeyboard.CreateInput(Keys.Return, true),
         VirtualKeyboard.CreateInput(Keys.Return, false)
     };
     for (int i = 0; i < array.Length; i++)
     {
         VirtualKeyboard.SendInput(1, ref array[i], Marshal.SizeOf(array[i]));
         Thread.Sleep(KeyInterval);
     }
 }
Пример #3
0
 private static extern void SendInput(int nInputs, ref VirtualKeyboard.INPUT pInputs, int cbsize);