public override bool Isworkingkey(VKeys key, bool Isdown)
 {
     if (key == Up.keyValue)
     {
         Up.Isđown = Isdown; return(true);
     }
     if (key == Down.keyValue)
     {
         Down.Isđown = Isdown; return(true);
     }
     if (key == Left.keyValue)
     {
         Left.Isđown = Isdown; return(true);
     }
     if (key == Right.keyValue)
     {
         Right.Isđown = Isdown; return(true);
     }
     return(false);
 }
 public bool IsDown(VKeys key)
 {
     if ((int)key < 256)
     {
         return(IsDownRaw(key));
     }
     if (key == VKeys.MENU)
     {
         return(IsDownRaw(VKeys.LMENU) || IsDownRaw(VKeys.RMENU));
     }
     if (key == VKeys.SHIFT)
     {
         return(IsDownRaw(VKeys.LSHIFT) || IsDownRaw(VKeys.RSHIFT));
     }
     if (key == VKeys.CONTROL)
     {
         return(IsDownRaw(VKeys.LCONTROL) || IsDownRaw(VKeys.RCONTROL));
     }
     return(false);
 }
예제 #3
0
        private void MeleeCountDownKeyHook(VKeys key)
        {
            switch (key)
            {
            case VKeys.KEY_Q:
                this.OnQPressed();
                break;

            case VKeys.KEY_E:
                this.OnEPressed();
                break;

            case VKeys.ESCAPE:
                this.OnEPressed();
                break;

            default:
                // Do nothing for now
                break;
            }
        }
        /// <summary>
        /// Send an event for a set of keys.
        /// </summary>
        /// <param name="modifierKeys">Modifier keys associated with each key event.</param>
        /// <param name="keys">The associated keys.</param>
        /// <param name="eventType">The event type.</param>
        public static void SendKeys(ModifierKeys modifierKeys, VKeys[] keys, KeyEventType eventType)
        {
            Assert.ParamIsNotNull(keys);

            List<INPUT> inputBuffer = new List<INPUT>();

            if (eventType == KeyEventType.Down)
            {
                // Key down events
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Shift))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.SHIFT, KeyEventType.Down));
                }
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Control))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.CONTROL, KeyEventType.Down));
                }
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Alt))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.MENU, KeyEventType.Down));
                }
                foreach (VKeys key in keys)
                {
                    inputBuffer.Add(CreateKeyEvent(key, KeyEventType.Down));
                }
            }
            else
            {
                // Add key up events
                foreach (VKeys key in keys)
                {
                    inputBuffer.Add(CreateKeyEvent(key, KeyEventType.Up));
                }
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Alt))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.MENU, KeyEventType.Up));
                }
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Control))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.CONTROL, KeyEventType.Up));
                }
                if (Utility.IsFlagSet(modifierKeys, Bespoke.Common.ModifierKeys.Shift))
                {
                    inputBuffer.Add(CreateKeyEvent(VKeys.SHIFT, KeyEventType.Up));
                }
            }

            if (inputBuffer.Count > 0)
            {
                INPUT[] buffer = inputBuffer.ToArray();
                SendInput((uint)buffer.Length, buffer, Marshal.SizeOf(buffer[0]));
            }
        }
예제 #5
0
 public static bool IsModifierKey(VKeys key)
 {
     return(BaseModifierKeys.Contains(key));
 }
예제 #6
0
 public static bool IsReleased(VKeys key)
 {
     return(!IsPressed(key));
 }
예제 #7
0
 public static void SendHardwareKeyUp(VKeys toscanboy)
 {
     keybd_event(MagicCSGObVk, GetHardwareScan(toscanboy), 0x0002, 0); //Key up
 }
예제 #8
0
 public static void PostMessage_PressKeyUp(int hWnd, VKeys Key, int lParam)
 {
     PostMessage(hWnd, (int)WMessages.WM_KEYUP, (int)Key, lParam);
 }
예제 #9
0
 public static void Send(IntPtr WindowHandle, VKeys Key)
 {
     SendMessage(WindowHandle, (int)Key, 0, 0);
 }
 public void SendKeyUp(VKeys key)
 {
     SendMessage(_handler, (int)WMessages.WM_KEYUP, (int)key, 0);
 }
 public void SendKeyPres(VKeys key)
 {
     SendKeyDown(key);
     SendKeyUp(key);
 }
 public void SendKeyDown(VKeys key)
 {
     SendMessage(_handler, (int)WMessages.WM_KEYDOWN, (int)key, 0);
 }
예제 #13
0
        public override void Work_Key(VKeys key, bool IsDown, Switcher switcher)
        {
            if (Isworkingkey(key, IsDown))
            {
                //select mode of sreeen to calculatim
                int R_x  = 1;
                int R_y  = 1;
                int R_Df = 1;
                int R_Ds = 1;
                switch (switcher.Currentinformation.ScreenOrentation)
                {
                case ScreenOrentation.LEFT_HORIZONTAL: R_x = 1; R_y = 1; R_Ds = 1; R_Df = 0; break;

                case ScreenOrentation.RIGHT_HORIZONTAL: R_x = -1; R_y = -1; R_Ds = 1; R_Df = 0; break;

                case ScreenOrentation.MIDDLE_VERTICAL: R_x = 1; R_y = -1; R_Ds = 0; R_Df = 1; break;
                }
                //calular postion
                double DX = 0, DY = 0;
                double Lta = Math.Sin((corner * Math.PI) / 180) * 0.5 * this.Width;
                //sử lý các sự kiên khi key down hoạt key up
                if (finger.State == StateFinger.UP)
                {
                    // sau khi put finger thì statet finger sẽ chuyển sang down
                    Handremote.PutFinger(this.X, this.Y, this);
                }
                else
                {
                    if (!Up.Isđown && !Down.Isđown && !Left.Isđown && !Right.Isđown)
                    {
                        Handremote.UpFinger(this);
                    }
                }
                //tất cả các tổ hợp phím sẽ xử lí

                //xử lí các trượng hơn key đơn
                if (key == Up.keyValue)
                {
                    DX = this.X + this.Width / 2 * R_Ds * R_y;
                    DY = this.Y - this.Width / 2 * R_Df * R_x;
                    goto DoublekeyStrkey;
                }
                if (key == Down.keyValue)
                {
                    DX = this.X - this.Width / 2 * R_Ds * R_y;
                    DY = this.Y + this.Width / 2 * R_Df * R_x;
                    goto DoublekeyStrkey;
                }
                if (key == Left.keyValue)
                {
                    DX = this.X - this.Width / 2 * R_Df * R_x;
                    DY = this.Y - this.Width / 2 * R_Ds * R_y;
                    goto DoublekeyStrkey;
                }
                if (key == Right.keyValue)
                {
                    DX = this.X + this.Width / 2 * R_Df * R_x;
                    DY = this.Y + this.Width / 2 * R_Ds * R_y;
                    goto DoublekeyStrkey;
                }
                //các trường hợp key đôi
DoublekeyStrkey:
                if (Up.Isđown && Left.Isđown)
                {
                    DX = this.X + Lta * R_y;
                    DY = this.Y - Lta * R_x;
                    if (key == Up.keyValue || key == Left.keyValue)
                    {
                        goto PutStrokeKey;
                    }
                }
                if (Up.Isđown && Right.Isđown)
                {
                    DX = this.X + Lta * R_x;
                    DY = this.Y + Lta * R_y;
                    if (key == Up.keyValue || key == Right.keyValue)
                    {
                        goto PutStrokeKey;
                    }
                }
                if (Down.Isđown && Left.Isđown)
                {
                    DX = this.X - Lta * R_x;
                    DY = this.Y - Lta * R_y;
                    if (key == Down.keyValue || key == Left.keyValue)
                    {
                        goto PutStrokeKey;
                    }
                }
                if (Down.Isđown && Right.Isđown)
                {
                    DX = this.X - Lta * R_y;
                    DY = this.Y + Lta * R_x;
                    if (key == Down.keyValue || key == Right.keyValue)
                    {
                        goto PutStrokeKey;
                    }
                }
                //thực hiện nhấn vầ di chuyền phím nhấn
PutStrokeKey:
                if (Up.Isđown || Down.Isđown || Left.Isđown || Right.Isđown)
                {
                    if (tokenSource != null)
                    {
                        tokenSource.Cancel();
                    }
                    tokenSource = new CancellationTokenSource();
                    new Thread(() =>
                    {
                        Handremote.MoveFinger(DX, DY, this, false);
                    })
                    {
                        IsBackground = true
                    }.Start();
                }
            }
        }
예제 #14
0
        private static bool IsKeyPress(VKeys key)
        {
            RETURN_GetAsyncKeyState rtnVal = (RETURN_GetAsyncKeyState)GetAsyncKeyState((int)key);

            return(RETURN_GetAsyncKeyState.YN.Equals(rtnVal) || RETURN_GetAsyncKeyState.YY.Equals(rtnVal));
        }
예제 #15
0
 public virtual bool Isworkingkey(VKeys key, bool Isdown)
 {
     return(false);
 }
예제 #16
0
 public virtual void Work_Key(VKeys key, bool IsDown, Switcher switcher)
 {
 }
예제 #17
0
 public static     INPUT[] CreatArrow(VKeys vKeys)
 {
     return(new[]
     {
         new INPUT()
         {
             type = INPUT_TYPE.KEYBOARD,
             u = new INPUT_U
             {
                 ki = new KEYBDINPUT
                 {
                     wVk = Convert.ToUInt16(VKeys.LMENU),
                     wScan = 0,
                     dwFlags = Convert.ToUInt32(KEYEVENTF.KEYUP),
                     dwExtraInfo = IntPtr.Zero
                 }
             }
         },
         new INPUT()
         {
             type = INPUT_TYPE.KEYBOARD,
             u = new INPUT_U
             {
                 ki = new KEYBDINPUT
                 {
                     wVk = Convert.ToUInt16(VKeys.KEY_A),
                     wScan = 0,
                     dwFlags = Convert.ToUInt32(KEYEVENTF.KEYUP),
                     dwExtraInfo = IntPtr.Zero
                 }
             }
         },
         new INPUT()
         {
             type = INPUT_TYPE.KEYBOARD,
             u = new INPUT_U
             {
                 ki = new KEYBDINPUT
                 {
                     wVk = Convert.ToUInt16(vKeys),
                     wScan = 0,
                     dwFlags = 0 | Convert.ToUInt32(KEYEVENTF.EXTENDEDKEY),
                     dwExtraInfo = IntPtr.Zero
                 }
             }
         },
         new INPUT()
         {
             type = INPUT_TYPE.KEYBOARD,
             u = new INPUT_U
             {
                 ki = new KEYBDINPUT
                 {
                     wVk = Convert.ToUInt16(vKeys),
                     wScan = 0,
                     dwFlags = 0 | Convert.ToUInt32(KEYEVENTF.KEYUP),
                     dwExtraInfo = IntPtr.Zero
                 }
             }
         },
         //new INPUT()
         //{
         //    type = INPUT_TYPE.KEYBOARD,
         //    u = new INPUT_U
         //    {
         //        ki = new KEYBDINPUT
         //        {
         //            wVk = Convert.ToUInt16(VKeys.LMENU),
         //            wScan = 0,
         //            dwFlags = 0,
         //            dwExtraInfo = IntPtr.Zero
         //        }
         //    }
         //},
     });
 }
예제 #18
0
 private static uint GetScanCode(VKeys key)
 {
     return(MapVirtualKey((uint)key, MAPVK_VK_TO_VSC_EX));
 }
 public void SendKeyUp(VKeys key)
 {
     SendMessage(_handler, (int)WMessages.WM_KEYUP, (int)key, 0);
 }
예제 #20
0
		private static uint GetDwExtraInfo(Int16 repeatCount, VKeys key, byte extended, byte contextCode, byte previousState,
			byte transitionState)
		{
			var lParam = (uint) repeatCount;
			uint scanCode = MapVirtualKey((uint) key, MAPVK_VK_TO_VSC_EX) + 0x80;
			lParam += scanCode*0x10000;
			lParam += (uint) ((extended)*0x1000000);
			lParam += (uint) ((contextCode*2)*0x10000000);
			lParam += (uint) ((previousState*4)*0x10000000);
			lParam += (uint) ((transitionState*8)*0x10000000);
			return lParam;
		}
예제 #21
0
 private static bool PostMessageKeyUp(IntPtr hWnd, VKeys key)
 {
     return(PostMessageSafe(hWnd, (int)Message.KEY_UP, (uint)key, GetLParam(1, key, 0, 0, 0, 0)));
 }
 public void SendKeyPres(VKeys key)
 {
     SendKeyDown(key);
     SendKeyUp(key);
 }
예제 #23
0
 private void Keyboard_KeyUp(VKeys key)
 {
     ChangecolorButton(key, false);
 }
예제 #24
0
 public static void SendHardwareKeyDown(VKeys toscanboy)
 {
     Console.WriteLine("the hardware boy is " + GetHardwareScan(toscanboy));
     keybd_event(MagicCSGObVk, GetHardwareScan(toscanboy), 0, 0); //Key down
 }
예제 #25
0
 private void Keyboard_KeyDown(VKeys key)
 {
     ChangecolorButton(key, true);
 }
예제 #26
0
        public static byte GetHardwareScan(VKeys v)
        {
            switch (v)
            {
            //https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa299374(v=vs.60)
            case VKeys.VK_ESCAPE: return(0x1);

            case VKeys.VK_1: return(0x2);

            case VKeys.VK_2: return(0x3);

            case VKeys.VK_3: return(0x4);

            case VKeys.VK_4: return(0x5);

            case VKeys.VK_5: return(0x6);

            case VKeys.VK_6: return(0x7);

            case VKeys.VK_7: return(0x8);

            case VKeys.VK_8: return(0x9);

            case VKeys.VK_9: return(0xA);

            case VKeys.VK_SUBTRACT: return(0xC);

            case VKeys.VK_BACK: return(0xE);

            case VKeys.VK_TAB: return(0xF);

            case VKeys.VK_Q: return(0x10);

            case VKeys.VK_W: return(0x11);

            case VKeys.VK_E: return(0x12);

            case VKeys.VK_R: return(0x13);

            case VKeys.VK_T: return(0x14);

            case VKeys.VK_Y: return(0x15);

            case VKeys.VK_U: return(0x16);

            case VKeys.VK_I: return(0x17);

            case VKeys.VK_O: return(0x18);

            case VKeys.VK_P: return(0x19);

            case VKeys.VK_RETURN: return(0x1C);

            case VKeys.VK_CONTROL: return(0x1D);

            case VKeys.VK_A: return(0x1E);

            case VKeys.VK_S: return(0x1F);

            case VKeys.VK_D: return(0x20);

            case VKeys.VK_F: return(0x21);

            case VKeys.VK_G: return(0x22);

            case VKeys.VK_H: return(0x23);

            case VKeys.VK_J: return(0x24);

            case VKeys.VK_K: return(0x25);

            case VKeys.VK_L: return(0x26);

            //case VKeys.VK_COLON: return 0x27;
            //case VKeys.VK_QUOTE: return 0x28;
            //case VKeys.VK_TILDE: return 0x29;
            case VKeys.VK_LSHIFT: return(0x2A);

            //case VKeys.VK_BACKSLASH: return 0x2B;
            case VKeys.VK_Z: return(0x2C);

            case VKeys.VK_X: return(0x2D);

            case VKeys.VK_C: return(0x2E);

            case VKeys.VK_V: return(0x2F);

            case VKeys.VK_B: return(0x30);

            case VKeys.VK_N: return(0x31);

            case VKeys.VK_M: return(0x32);

            //case VKeys.VK_COMMA: return 0x33;
            case VKeys.VK_DECIMAL: return(0x34);

            //case VKeys.VK_QUESTION: return 0x35;
            case VKeys.VK_RSHIFT: return(0x36);

            //case VKeys.VK_LALT: return 0x38;
            //case VKeys.VK_RALT: return 0x38;
            case VKeys.VK_SPACE: return(0x39);

            case VKeys.VK_CAPITAL: return(0x3A);

            case VKeys.VK_F1: return(0x3B);

            case VKeys.VK_F2: return(0x3C);

            case VKeys.VK_F3: return(0x3D);

            case VKeys.VK_F4: return(0x3E);

            case VKeys.VK_F5: return(0x3F);

            case VKeys.VK_F6: return(0x40);

            case VKeys.VK_F7: return(0x41);

            case VKeys.VK_F8: return(0x42);

            case VKeys.VK_F9: return(0x43);

            case VKeys.VK_F10: return(0x44);

            case VKeys.VK_F11: return(0x57);

            case VKeys.VK_F12: return(0x58);

            //case VKeys.NUMLOCK return 0x45;
            case VKeys.VK_SCROLL: return(0x46);

            case VKeys.VK_HOME: return(0x47);

            case VKeys.VK_UP: return(0x48);

            case VKeys.VK_PRIOR: return(0x49);

            case VKeys.VK_LEFT: return(0x4B);

            //case VKeys.VK_CENTER: return 0x4C;
            case VKeys.VK_RIGHT: return(0x4D);

            case VKeys.VK_END: return(0x4F);

            case VKeys.VK_DOWN: return(0x50);

            case VKeys.VK_NEXT: return(0x51);

            case VKeys.VK_INSERT: return(0x52);

            case VKeys.VK_DELETE: return(0x53);

            default: return(0xFF);
            }
        }
예제 #27
0
        private void ChangecolorButton(VKeys key, bool iskeyDown)
        {
            if (iskeyDown)
            {
                switch (key)
                {
                case VKeys.KEY_W:
                    W_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_S:
                    S_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_A:
                    A_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_D:
                    D_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_Q:
                    Q_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_E:
                    E_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_Z:
                    Z_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_X:
                    X_key.Background = yellowcolor;
                    break;

                case VKeys.KEY_C:
                    C_key.Background   = yellowcolor;
                    C_O_key.Background = yellowcolor;
                    break;

                case VKeys.LCONTROL:
                    Ctrl_O_key.Background = yellowcolor;
                    break;

                case VKeys.RCONTROL:
                    Ctrl_O_key.Background = yellowcolor;
                    break;

                case VKeys.LSHIFT:
                    Shift_O_key.Background = yellowcolor;
                    break;

                case VKeys.RSHIFT:
                    Shift_O_key.Background = yellowcolor;
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (key)
                {
                case VKeys.KEY_W:
                    W_key.Background = bluecolor;
                    break;

                case VKeys.KEY_S:
                    S_key.Background = bluecolor;
                    break;

                case VKeys.KEY_A:
                    A_key.Background = bluecolor;
                    break;

                case VKeys.KEY_D:
                    D_key.Background = bluecolor;
                    break;

                case VKeys.KEY_Q:
                    Q_key.Background = bluecolor;
                    break;

                case VKeys.KEY_E:
                    E_key.Background = bluecolor;
                    break;

                case VKeys.KEY_Z:
                    Z_key.Background = bluecolor;
                    break;

                case VKeys.KEY_X:
                    X_key.Background = bluecolor;
                    break;

                case VKeys.KEY_C:
                    C_key.Background   = bluecolor;
                    C_O_key.Background = orangecolor;
                    break;

                case VKeys.LCONTROL:
                    Ctrl_O_key.Background = orangecolor;
                    break;

                case VKeys.RCONTROL:
                    Ctrl_O_key.Background = orangecolor;
                    break;

                case VKeys.LSHIFT:
                    Shift_O_key.Background = orangecolor;
                    break;

                case VKeys.RSHIFT:
                    Shift_O_key.Background = orangecolor;
                    break;

                default:
                    break;
                }
            }
        }
예제 #28
0
        public static void PostMessage_PressKey(int hWnd, VKeys Key, int lParam)
        {
            PostMessage(hWnd, (int)WMessages.WM_KEYDOWN, (int)Key, lParam);
            PostMessage(hWnd, (int)WMessages.WM_KEYUP, (int)Key, lParam);

            //---------------------------------------------------------------------------

            /*
             * Key    wParam  lParam
             * 1      31      20001
             * 2      32      30001
             * 3      33      40001
             * 4      34      50001
             * 5      35      60001
             * 6      36      70001
             * 7      37      80001
             * 8      38      90001
             * 9      39      a0001
             * -      bd      c0001
             * ^      de      280001
             \      dc      2b0001
             \ q      51      100001
             \ w      57      110001
             \ e      45      120001
             \ r      52      130001
             \ t      54      140001
             \ y      59      150001
             \ u      55      160001
             \ i      49      170001
             \ o      4f      180001
             \ p      50      190001
             \ @      c0      290001
             \ [      db      1a0001
             \ a      41      1e0001
             \ s      53      1f0001
             \ d      44      200001
             \ f      46      210001
             \ g      47      220001
             \ h      48      230001
             \ j      4a      240001
             \ k      4b      250001
             \ l      4c      260001
             \ ;      bb      d0001
             \ :      ba      270001
             \ ]      dd      1b0001
             \ z      5a      2c0001
             \ x      58      2d0001
             \ c      43      2e0001
             \ v      56      2f0001
             \ b      42      300001
             \ n      4e      310001
             \ m      4d      320001
             \ ,      bc      330001
             \ .      be      340001
             \ /      bf      350001
             \ (_)    df      550001
             \ [ESC]  1b      10001
             \ [TAB]  9       f0001
             \ [CTRL-L] 11    1d0001
             \ [CAPS] 14      3a0001
             \ [SHIFT-L] 10   2a0001
             \ [??] 15      11d0001
             \ [WIN-L] 5b     15b0001
             \ [GRPH] ????
             \ [NFER] 1d      5a0001
             \ [SPACE] 20     390001
             \ [BS]   8       e0001
             \ [RET]  d       1c0001
             \ [SHIFT-R] 10   360001
             \ [XFER] 1c      1380001
             \ [WIN-R] 5c     15c0001
             \ [???]  5d      15d0001
             \ [INS]  2d      1520001
             \ [DEL]  2e      1530001
             \ [ROLLUP] 22    1510001
             \ [ROLLDN] 21    1490001
             \ [?]   26      1480001
             \ [?]   25      14b0001
             \ [?]   27      14d0001
             \ [?]   28      1500001
             \ [HOMECLR] 24   1470001
             \ [HELP] 23      14f0001
             \ [-]    6d      4a0001
             \ [/]    6f      1350001
             \ [*]    6a      370001
             \ [+]    6b      4e0001
             \ [=]    92      590001
             \ [RET]  d       1c0001
             \ [7]    67      470001
             \ [8]    68      480001
             \ [9]    69      490001
             \ [4]    64      4b0001
             \ [5]    65      4c0001
             \ [6]    66      4d0001
             \ [1]    61      4f0001
             \ [2]    62      500001
             \ [3]    63      510001
             \ [0]    60      520001
             \ [,]    6c      5c0001
             \ [.]    6e      530001
             \ [STOP] ????
             \ [COPY] ????
             \ [F1]   70      3b0001
             \ [F2]   71      3c0001
             \ [F3]   72      3d0001
             \ [F4]   73      3e0001
             \ [F5]   74      3f0001
             \ [F6]   75      400001
             \ [F7]   76      410001
             \ [F8]   77      420001
             \ [F9]   78      430001
             \ [F10] ????(ALT??????)
             \ [VF1]  7a      570001
             \ [VF2]  7b      580001
             \ [VF3]  7c      5d0001
             \ [VF4]  7d      5e0001
             \ [VF5]  7e      5f0001
             \
             */
        }
예제 #29
0
파일: Messaging.cs 프로젝트: xiaoli/Wow
 public static void SendVKeys(IntPtr hWnd, VKeys key)
 {
     PostMessage(hWnd, new Key(key));
 }
예제 #30
0
 public static bool IsPressed(VKeys key)
 {
     return(Hook.GetDownedKeys().Contains(key));
 }
 public bool IsKeyPressed(VKeys key)
 {
     return((GetKeyState((int)key) & 0x8000) != 0);
 }
 /// <summary>
 /// Send a "down" then "up" event for a set of keys.
 /// </summary>
 /// <param name="modifierKeys">Modifier keys associated with each key event.</param>
 /// <param name="keys">The associated keys.</param>
 public static void SendKeys(ModifierKeys modifierKeys, VKeys[] keys)
 {
     SendKeys(modifierKeys, keys, KeyEventType.Down);
     SendKeys(modifierKeys, keys, KeyEventType.Up);
 }
예제 #33
0
 public void MapDataSwitch(uint switchNumber, VKeys key)
 {
     _dataSwitchMappings[switchNumber] = key;
 }
        private static INPUT CreateKeyEvent(VKeys key, KeyEventType eventType)
        {
            INPUT keyEvent = new INPUT();
            keyEvent.type = INPUT_KEYBOARD;
            keyEvent.ki.wVk = (ushort)key;
            keyEvent.ki.wScan = 0;
            keyEvent.ki.dwFlags = (uint)eventType;
            keyEvent.ki.time = 0;
            keyEvent.ki.dwExtraInfo = (IntPtr)0;

            return keyEvent;
        }
예제 #35
0
 private void AddKey(string key, VKeys value)
 {
     keyNames[key] = value;
     displayOrder.Add(key);
 }
예제 #36
0
		private static uint GetScanCode(VKeys key)
		{
			return MapVirtualKey((uint) key, MAPVK_VK_TO_VSC_EX);
		}
 public void SendKeyDown(VKeys key)
 {
     SendMessage(_handler, (int)WMessages.WM_KEYDOWN, (int)key, 0);
 }
예제 #38
0
		private static uint GetLParam(Int16 repeatCount, VKeys key, byte extended, byte contextCode, byte previousState,
			byte transitionState)
		{
			var lParam = (uint) repeatCount;
			//uint scanCode = MapVirtualKey((uint)key, MAPVK_VK_TO_CHAR);
			uint scanCode = GetScanCode(key);
			lParam += scanCode*0x10000;
			lParam += (uint) ((extended)*0x1000000);
			lParam += (uint) ((contextCode*2)*0x10000000);
			lParam += (uint) ((previousState*4)*0x10000000);
			lParam += (uint) ((transitionState*8)*0x10000000);
			return lParam;
		}
예제 #39
0
 public static void Send(string WindowTitle, string ControlName, VKeys Key)
 {
     IntPtr hWnd = FindWindow(ControlName, WindowTitle);
     SendMessage(hWnd, (int)Key, 0, 0);
 }
예제 #40
0
 static extern bool GetAsyncKeyState(VKeys vKey);
예제 #41
0
 public KeyEventArgs(bool down, VKeys keys)
 {
     this.Down    = down;
     this.Keys    = keys;
     this.Handled = false;
 }