internal static KeyboardInput.KeyUpDown GetSpecialKeyCode(bool specialKey, KeyboardInput.KeyUpDown key) { if (specialKey && ScanCodeDependent.Contains((KeyboardInput.SpecialKeys)key)) { key |= KeyboardInput.KeyUpDown.KEYEVENTF_EXTENDEDKEY; } return(key); }
private void SendKeyUp(short b, bool specialKey) { if (!keysHeld.Contains(b)) { throw new InputDeviceException(string.Format("Cannot unpress the key {0}, it has not been pressed", b)); } keysHeld.Remove(b); KeyboardInput.KeyUpDown keyUpDown = GetSpecialKeyCode(specialKey, KeyboardInput.KeyUpDown.KEYEVENTF_KEYUP, b); SendInput(GetInputFor(b, keyUpDown)); }
private void SendKeyDown(short b, bool specialKey) { if (keysHeld.Contains(b)) { throw new InputDeviceException(string.Format("Cannot press the key {0} as its already pressed", b)); } keysHeld.Add(b); KeyboardInput.KeyUpDown keyUpDown = GetSpecialKeyCode(specialKey, KeyboardInput.KeyUpDown.KEYEVENTF_KEYDOWN); SendInput(GetInputFor(b, keyUpDown)); }
private static Input GetInputFor(short character, KeyboardInput.KeyUpDown keyUpOrDown) { return(InputFactory.Keyboard(new KeyboardInput(character, keyUpOrDown, GetMessageExtraInfo()))); }
private void SendKeyDown(short b, bool specialKey) { keysHeld.Add(b); KeyboardInput.KeyUpDown keyUpDown = GetSpecialKeyCode(specialKey, KeyboardInput.KeyUpDown.KEYEVENTF_KEYDOWN); SendInput(GetInputFor(b, keyUpDown)); }