Пример #1
0
        public static void SendCtrlC()
        {
            IntPtr stdHandle = Native.GetStdHandle(4294967286U);

            Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
            r.EventType         = (short)1;
            r.bKeyDown          = true;
            r.wRepeatCount      = (short)1;
            r.wVirtualKeyCode   = (short)67;
            r.wVirtualScanCode  = (short)0;
            r.dwControlKeyState = 8;
            int countOut;

            Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
            r.bKeyDown = false;
            Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
        }
Пример #2
0
        public static void SendCharCode(int code)
        {
            IntPtr stdHandle = Native.GetStdHandle(4294967286U);

            Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
            r.EventType         = (short)1;
            r.bKeyDown          = true;
            r.wRepeatCount      = (short)1;
            r.wVirtualKeyCode   = checked ((short)code);
            r.wVirtualScanCode  = (short)0;
            r.UnicodeChar       = char.MinValue;
            r.dwControlKeyState = 0;
            int countOut;

            Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
            r.bKeyDown = false;
            Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
        }
Пример #3
0
        public static void SendVKCodeDown(int code, int repeatCount)
        {
            IntPtr stdHandle = Native.GetStdHandle(4294967286U);

            Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
            int num1 = 1;
            int num2 = repeatCount;
            int num3 = num1;

            while (num3 <= num2)
            {
                r.EventType         = (short)1;
                r.bKeyDown          = true;
                r.wRepeatCount      = (short)1;
                r.wVirtualKeyCode   = checked ((short)code);
                r.wVirtualScanCode  = (short)0;
                r.dwControlKeyState = 0;
                int countOut;
                Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
                checked { ++num3; }
            }
        }
Пример #4
0
 internal static extern bool WriteConsoleInput(IntPtr hIn, [MarshalAs(UnmanagedType.LPStruct)] Native.KEY_INPUT_RECORD r, int count, out int countOut);
Пример #5
0
 public static void SendVKCodeUp(int code, int repeatCount)
 {
     IntPtr stdHandle = Native.GetStdHandle(4294967286U);
     Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
     int num1 = 1;
     int num2 = repeatCount;
     int num3 = num1;
     while (num3 <= num2)
     {
         r.EventType = (short)1;
         r.bKeyDown = false;
         r.wRepeatCount = (short)1;
         r.wVirtualKeyCode = checked((short)code);
         r.wVirtualScanCode = (short)0;
         r.dwControlKeyState = 0;
         int countOut;
         Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
         checked { ++num3; }
     }
 }
Пример #6
0
 public static void SendCtrlC()
 {
     IntPtr stdHandle = Native.GetStdHandle(4294967286U);
     Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
     r.EventType = (short)1;
     r.bKeyDown = true;
     r.wRepeatCount = (short)1;
     r.wVirtualKeyCode = (short)67;
     r.wVirtualScanCode = (short)0;
     r.dwControlKeyState = 8;
     int countOut;
     Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
     r.bKeyDown = false;
     Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
 }
Пример #7
0
 public static void SendCharCode(int code)
 {
     IntPtr stdHandle = Native.GetStdHandle(4294967286U);
     Native.KEY_INPUT_RECORD r = new Native.KEY_INPUT_RECORD();
     r.EventType = (short)1;
     r.bKeyDown = true;
     r.wRepeatCount = (short)1;
     r.wVirtualKeyCode = checked((short)code);
     r.wVirtualScanCode = (short)0;
     r.UnicodeChar = char.MinValue;
     r.dwControlKeyState = 0;
     int countOut;
     Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
     r.bKeyDown = false;
     Native.WriteConsoleInput(stdHandle, r, 1, out countOut);
 }