/// <include file='Internal.xml' path='Docs/KeyboardHook/GetKeyboardReading/*'/> protected KeyboardHookEventArgs GetKeyboardReading(IntPtr lparam) { ThrowIfDisposed(); int vkCode; int alt; int ctrl; int shift; int capsLock; if (!InternalGetKeyboardReading(lparam, out vkCode, out alt, out ctrl, out shift, out capsLock)) { throw new ManagedHooksException("Failed to access keyboard settings."); } VirtualKeys vk = (VirtualKeys)vkCode; System.Windows.Forms.Keys key = ConvertKeyCode(vk); if ((int)key == -1) { return(null); } return(new KeyboardHookEventArgs(key, alt == 1, ctrl == 1, shift == 1, capsLock == 1)); }
/// <inheritdoc /> public override void UnregisterHotKey(VirtualKeys key, Modifiers modifiers) { // remove no repeat before adding to list to avoid getting different hash modifiers = (Modifiers)((uint)modifiers & 0xF); KeyModifierCombination combination = new KeyModifierCombination(key, modifiers); if (!HotKeys.ContainsKey(combination)) { String error = $"Failed to unregister hotKey : HotKey \"{key}+{modifiers}\" is not registered"; Logger.Warn(error); throw new HotKeyException(error); } try { HotKey tmpHotKey = HotKeys[combination]; tmpHotKey.UnregisterHotKey(); HotKeysId.Remove(tmpHotKey.Id); HotKeys.Remove(combination); } catch (HotKeyException e) { Logger.Warn("Failed to unregister hotKey : {0}", e.Message); throw; } }
/// <summary>Is called when a key is pressed.</summary> /// <param name="key">The key.</param> internal override void KeyDown(VirtualKeys key) { switch (key) { case VirtualKeys.B1: // --- reset the system --- if ((this.State == States.Brake | this.State == States.Service | this.State == States.Emergency) & this.Train.Handles.Reverser == 0 & this.Train.Handles.PowerNotch == 0 & this.Train.Handles.BrakeNotch >= this.Train.Specs.BrakeNotches) { foreach (Pattern pattern in this.Patterns) { if (Math.Abs(this.Train.State.Speed.MetersPerSecond) >= pattern.WarningPattern) { pattern.Clear(); } } this.State = States.Normal; this.Train.Sounds.AtsPBell.Play(); } break; case VirtualKeys.B2: // --- brake release --- if ((this.State == States.Normal | this.State == States.Pattern) & !BrakeRelease & DurationOfBrakeRelease > 0.0) { BrakeRelease = true; BrakeReleaseCountdown = DurationOfBrakeRelease; this.Train.Sounds.AtsPBell.Play(); } break; } }
/// <summary> /// Create a new accelerator from the given accelerator key and virtual key combination. /// </summary> /// <param name="acceleratorKey"> /// The accelerator key (Ctrl, Alt, or Shift). Can be combined with | to form more complicated keystrokes /// such as Ctrl + Alt + Space. /// </param> /// <param name="virtualKey"> /// The virtual key code (may not be Ctrl, Alt, or Shift). /// </param> public Accelerator(AcceleratorKeys acceleratorKey, VirtualKeys virtualKey) { AcceleratorKey = acceleratorKey; VirtualKey = virtualKey; Command = Macros.MAKEWORD((byte)AcceleratorKey, (byte)VirtualKey); lock(builderLock) { //create a string representation of this accelerators keystroke such as "CONTROL + SPACE" foreach(var key in acceleratorKeys.Keys) { if(AcceleratorKey.Any(key)) { stringBuilder.Append(acceleratorKeys[key]) .Append(SEPARATOR); } } stringBuilder.Append(virtualKeys[VirtualKey]); str = stringBuilder.ToString(); stringBuilder.Clear(); } Accel = new ACCEL() { fVirt = (byte)(AcceleratorKey | (AcceleratorKeys)VIRTKEY), key = (ushort)VirtualKey, cmd = Command }; }
public async Task <object> releaseKey(String key) { VirtualKeys keyNum = (VirtualKeys)Enum.Parse(typeof(VirtualKeys), key, true); keybd_event((byte)keyNum, 0, KEYEVENTF_KEYUP, UIntPtr.Zero); return(0); }
public async Task <object> holdKey(String key) { VirtualKeys keyNum = (VirtualKeys)Enum.Parse(typeof(VirtualKeys), key, true); keybd_event((byte)keyNum, 0, 0, UIntPtr.Zero); return(0); }
internal void KeyDown(VirtualKeys key) { foreach (Device device in devices.Values) { device.KeyDown(key); } }
static void sKeyUp(VirtualKeys key) { if (!GUCMenu.KeyUpUpdateMenus(key) && Active != null) { Active.KeyUp(key); } }
private void aim_key_Click(object sender, EventArgs e) { var key = PromptKey(); aim_key.Text = key.ToString(); _aim_key = key; }
/// <summary> /// Sends a virtual key. /// </summary> /// <param name="key"></param> /// <param name="KeyUp"></param> /// <param name="inputType"></param> public static void SendKey(VirtualKeys key, bool KeyUp, InputType inputType) { uint flagtosend; if (KeyUp) { flagtosend = (uint)(KeyEventF.KeyUp); } else { flagtosend = (uint)(KeyEventF.KeyDown); } Input[] inputs = { new Input { type = (int)inputType, u = new InputUnion { ki = new KeyboardInput { wVk = (ushort)key, wScan = 0, dwFlags = flagtosend, dwExtraInfo = GetMessageExtraInfo() } } } }; SendInput((uint)inputs.Length, inputs, Marshal.SizeOf(typeof(Input))); }
/// <summary>Is called when a virtual key is pressed.</summary> public void KeyDown(VirtualKeys key) { DVS.KeyDown(key); PanelManager.KeyDown(key, Panel); ATSSoundManager.PlayOnce(key); ATSSoundManager.PlayLoop(key); }
private void HookEx_Events(object sender, WindowsHookExEventArgs e) { if (KeyChange == null) { return; } KeyboardLLHookStruct @struct = (KeyboardLLHookStruct)Marshal.PtrToStructure((IntPtr)e.lParam, typeof(KeyboardLLHookStruct)); PressType pressType = PressType.None; VirtualKeys vk = (VirtualKeys)@struct.VirtualKeyCode; KeyboardState state = KeyboardState.FromCurrentState(); char?inputChar = null; if (e.wParam.ToInt64() == WM.KEYDOWN || e.wParam.ToInt64() == WM.SYSKEYDOWN) { pressType = PressType.KeyDown; } else if (e.wParam.ToInt64() == WM.KEYUP || e.wParam.ToInt64() == WM.SYSKEYUP) { pressType = PressType.KeyUp; } // Get Press Char char?PressKey = null; byte[] inBuffer = new byte[2]; if (User32.ToAscii(@struct.VirtualKeyCode, @struct.ScanCode, state.Bytes, inBuffer, @struct.Flags) == 1) { char ch = (char)inBuffer[0]; if (!char.IsControl(ch)) { PressKey = ch; if ((state.CapsLockToggled ^ state.ShiftPressed) && char.IsLetter(ch)) { PressKey = char.ToUpper(ch); } inputChar = PressKey; } } var args = new KeyChangeEventArgs() { Handled = false, PressType = pressType, Key = vk, KeyboardState = state, InputChar = inputChar, }; foreach (var action in KeyChange.GetInvocationList().Reverse()) { action.DynamicInvoke(this, args); if (args.Handled) { e.Handled = true; return; } } }
private void KeyboardInputSource_KeyboardInput(object sender, RawKeyboardInputEventArgs e) { // only evaluate this event if it is actually intended for this device //TODO: add some sort of conditional event invocation before this if (e.Header.hDevice != DeviceHandle) { return; } VirtualKeys key = (VirtualKeys)e.Data.VirtualKey; switch ((WM)e.Data.Message) { case WM.KEYDOWN: { KeyDown?.Invoke(this, new KeyInputEventArgs(key)); break; } case WM.KEYUP: { KeyUp?.Invoke(this, new KeyInputEventArgs(key)); break; } case WM.SYSKEYDOWN: { //TODO: syskeydown break; } } }
protected override void HookCallback(int code, UIntPtr wparam, IntPtr lparam) { if (KeyboardEvent == null) { return; } int vkCode = 0; KeyboardEvents kEvent = (KeyboardEvents)wparam.ToUInt32(); if (kEvent != KeyboardEvents.KeyDown && kEvent != KeyboardEvents.KeyUp && kEvent != KeyboardEvents.SystemKeyDown && kEvent != KeyboardEvents.SystemKeyUp) { return; } GetKeyboardReading(wparam, lparam, ref vkCode); VirtualKeys vk = (VirtualKeys)vkCode; Keys key; if (keyMap.TryGetValue(vk, out key)) { KeyboardEvent(kEvent, key); } }
/// <summary>Is called when a key is pressed.</summary> /// <param name="key">The key.</param> internal override void KeyDown(VirtualKeys key) { switch (key) { case VirtualKeys.C1: // --- switch to ats --- if (this.State == States.Normal | this.State == States.Service | this.State == States.Emergency) { if (this.Train.AtsSx != null | this.Train.AtsP != null) { this.State = States.Ats; this.Train.Sounds.ToAts.Play(); } } break; case VirtualKeys.C2: // --- switch to atc --- if (this.State == States.Ats) { this.State = States.Normal; this.Train.Sounds.ToAtc.Play(); } break; } }
internal static void KeyDown(VirtualKeys key) { if (key == rsettimerkey) { ResetTimer(); } else { switch (key) { case VirtualKeys.LeftDoors: if (ResetOnDoorMove) { ScheduleResetTimer = true; } break; case VirtualKeys.RightDoors: if (ResetOnDoorMove) { ScheduleResetTimer = true; } break; default: break; } } }
protected override void KeyPress(VirtualKeys key, bool hold) { if (hold) { return; } if (key == VirtualKeys.Escape || key == VirtualKeys.Tab) { Close(); } else if (key == VirtualKeys.Return || key == VirtualKeys.Control || key == VirtualKeys.Menu) { int amount = Convert.ToInt32(tb.Input.ToString().Length > 0 ? tb.Input : "0"); if (amount != 0) { amount = amount > maxAmount ? maxAmount : amount; NPCInst.Requests.DropItem(player, item, amount); } Close(); } else { tb.KeyPressed(key); } }
internal KeyDownEvent(Script script, VirtualKeys key) { this.Script = script; this.Conditions = new List<Condition>(); this.Actions = new List<Action>(); this.Key = key; }
// Public methods /// <summary> /// Sends a WM_KEYDOWN command to the assigned process. /// </summary> /// <param name="key">VirtualKey which will be the keystroke.</param> public async Task SendKeystroke(VirtualKeys key) { // Send the character keystroke to the process Win32.PostMessage(_settings.Process.MainWindowHandle, Win32.WM_KEYDOWN, (int)key, 0); // Delay between keystrokes, ensures that any next input is after this one and not before (in case this method is called in a loop) await Task.Delay(_settings.DelayBetweenKeyPresses); }
/// <summary> /// ATSキーが押されたときに呼び出される関数 /// </summary> /// <param name="key">ATSキー</param> internal override void KeyDown(VirtualKeys key) { switch (key) { case VirtualKeys.I: // 手元灯 LightSwDown(); break; case VirtualKeys.L: // LCD表示切り替え LcdSwDown(); break; default: break; } // 修飾キーの更新 if (modifier_key_ == null) { modifier_key_ = key; } // カスタムスイッチ for (int i = 0; i < LoadSwitch.ALL_SWITCH; i++) { if (SwitchCheck(0, key, LoadSwitch.switch_config_[i])) { SwitchRight(i, ref switch_[i], LoadSwitch.switch_config_[i]); } else if (SwitchCheck(1, key, LoadSwitch.switch_config_[i])) { SwitchLeft(i, ref switch_[i], LoadSwitch.switch_config_[i]); } } }
internal override void KeyUp(VirtualKeys key) { if (key == Train.CurrentKeyConfiguration.AWSKey) { awsKeyPressed = false; } }
public static Modifiers ToModifiers(this VirtualKeys vk) { switch (vk) { case VirtualKeys.Control: case VirtualKeys.LeftControl: case VirtualKeys.RightControl: return(Modifiers.CONTROL); case VirtualKeys.Shift: case VirtualKeys.LeftShift: case VirtualKeys.RightShift: return(Modifiers.SHIFT); case VirtualKeys.Menu: case VirtualKeys.LeftMenu: case VirtualKeys.RightMenu: return(Modifiers.ALT); case VirtualKeys.LeftWindows: case VirtualKeys.RightWindows: return(Modifiers.WIN); default: return(Modifiers.None); } }
public static bool IsModifiersExactKeyPress(this VirtualKeys vk) { return(vk == VirtualKeys.LeftControl || vk == VirtualKeys.RightControl || vk == VirtualKeys.LeftShift || vk == VirtualKeys.RightShift || vk == VirtualKeys.LeftMenu || vk == VirtualKeys.RightMenu || vk == VirtualKeys.LeftWindows || vk == VirtualKeys.RightWindows); }
internal void SendWmKey(VirtualKeys key, IntPtr lParam) { XplatUI.SendMessage(owner.Handle, Msg.WM_KEYDOWN, (IntPtr)key, lParam); if (owner.IsHandleCreated) // The previous line could have caused disposing the control (esc, enter, ...) XplatUI.SendMessage(owner.Handle, Msg.WM_KEYUP, (IntPtr)key, lParam); }
public void KeyPressed(VirtualKeys key) { switch (key) { case VirtualKeys.Left: rotation -= 8; break; case VirtualKeys.Right: rotation += 8; break; case VirtualKeys.Add: distance -= 8; break; case VirtualKeys.Subtract: distance += 8; break; default: return; } UpdateOrientation(); }
public static int onKeyboardAction(int nCode, int wParam, IntPtr lParam) { that.keyClickCounter = (that.keyClickCounter + 1) & (0xFFFF); if (!that.mouseOff) { // disable warning on variable not used. These definition are present mostly // for information and possible future use. #pragma warning disable 219 const int MOUSEEVENTF_LEFTDOWN = 0x02; const int MOUSEEVENTF_LEFTUP = 0x04; const int MOUSEEVENTF_RIGHTDOWN = 0x08; const int MOUSEEVENTF_RIGHTUP = 0x10; #pragma warning restore 219 KBDLLHOOKSTRUCT kbData = new KBDLLHOOKSTRUCT(); Marshal.PtrToStructure(lParam, kbData); VirtualKeys vkCode = (VirtualKeys)kbData.vkCode; long currentTicks = DateTime.Now.Ticks; int indexKey = Array.BinarySearch(ignoreKeys, vkCode); if (indexKey < 0) { that.mouseOff = true; that.mouseMoveStartTicks = 0L; } } int returnValue = (int)CallNextHookEx(hKeyboardHook, nCode, wParam, lParam); return(returnValue); }
/// <include file='ManagedHooks.xml' path='Docs/KeyboardHook/HookCallback/*'/> protected override void HookCallback(int code, UIntPtr wparam, IntPtr lparam) { if (KeyboardEvent == null) { return; } int vkCode = 0; KeyboardEvents kEvent = (KeyboardEvents)wparam.ToUInt32(); if (kEvent != KeyboardEvents.KeyDown && kEvent != KeyboardEvents.KeyUp && kEvent != KeyboardEvents.SystemKeyDown && kEvent != KeyboardEvents.SystemKeyUp) { return; } GetKeyboardReading(wparam, lparam, ref vkCode); VirtualKeys vk = (VirtualKeys)vkCode; System.Windows.Forms.Keys key = ConvertKeyCode(vk); if (key == System.Windows.Forms.Keys.Attn) { return; } KeyboardEvent(kEvent, key); }
public void KeyPressed(VirtualKeys key) { if (key == VirtualKeys.Left) { cursor--; if (cursor < 0) { cursor = choices.Count - 1; } } else if (key == VirtualKeys.Right) { cursor++; if (cursor >= choices.Count) { cursor = 0; } } else { return; } UpdateChoiceText(); if (OnChange != null) { OnChange(); } }
protected override void KeyPress(VirtualKeys key, bool hold) { long now = GameTime.Ticks; switch (key) { case VirtualKeys.Return: if (!hold) { items[cursor].OnActivate?.Invoke(); PlaySound(sndSelect); } break; case VirtualKeys.Escape: if (!hold) { this.Close(); OnEscape?.Invoke(); PlaySound(sndEscape); } break; default: if (CurrentItem is InputReceiver rec) { rec.KeyPressed(key); } break; } }
internal static bool IsKeyLocked(VirtualKeys key) { #if DriverDebug || DriverDebugState Console.WriteLine("IsKeyLocked ({0}): Called, Result={1}", key, driver.IsKeyLocked(key)); #endif return(driver.IsKeyLocked(key)); }
/// <summary>Is called when a key is released.</summary> /// <param name="key">The key.</param> internal void KeyUp(VirtualKeys key) { foreach (Device device in this.Devices) { device.KeyUp(key); } }
/// <summary>Is called when a key is pressed.</summary> /// <param name="key">The key.</param> internal override void KeyDown(VirtualKeys key) { switch (key) { case VirtualKeys.S: // --- acknowledge the alarm --- if (this.State == States.Alarm & this.Train.Handles.PowerNotch == 0 & this.Train.Handles.BrakeNotch >= this.Train.Specs.AtsNotch) { this.State = States.Chime; } break; case VirtualKeys.A1: // --- stop the chime --- if (this.State == States.Chime) { this.State = States.Normal; } break; case VirtualKeys.B1: // --- reset the system --- if (this.State == States.Emergency & this.Train.Handles.Reverser == 0 & this.Train.Handles.PowerNotch == 0 & this.Train.Handles.BrakeNotch == this.Train.Specs.BrakeNotches + 1) { this.State = States.Chime; } break; } }
public KeyGesture( VirtualKeys key, ModifierKeys modifiers, string displayString ) { if ( displayString == null ) throw new ArgumentNullException( "displayString" ); if ( !IsValid( key, modifiers ) ) throw new InvalidOperationException( "KeyGesture is invalid" ); this._modifiers = modifiers; this._key = key; this._displayString = displayString; }
private static int makeLp(VirtualKeys vk, int wmKey) { uint scanCode = User32.MapVirtualKey((uint)vk, 0); uint lParam = 0; lParam = (0x00000001 | (scanCode << 16)); if (wmKey != WMsg.WM_KEYDOWN) { lParam |= 0xc0000000; } return (int)lParam; }
internal override void KeyDown(VirtualKeys key) { if (key == VirtualKeys.C1) //Mode Up { if ((int)train.trainModeSelected < train.trainModeCount - 1) { trainModeNew = train.trainModeSelected + 1; } } else if (key == VirtualKeys.C2) //Mode Down { if ((int)train.trainModeSelected > 0) { trainModeNew = train.trainModeSelected - 1; } } }
public static void RingPst(IntPtr hwnd, VirtualKeys vk, RingPstType keytype) { switch (keytype) { case RingPstType.press: User32.PostMessageA((IntPtr)0x00d07aa, (uint)WMsg.WM_KEYDOWN, (int)vk, makeLp(vk, WMsg.WM_KEYDOWN)); User32.SendMessage((IntPtr)0x0004095e, (uint)WMsg.WM_KEYDOWN, vk, makeLp(vk, WMsg.WM_KEYDOWN)); System.Threading.Thread.Sleep(33); User32.PostMessageA((IntPtr)0x00d07aa, (uint)WMsg.WM_KEYUP, (int)vk, makeLp(vk, WMsg.WM_KEYUP)); User32.SendMessage((IntPtr)0x0004095e, (uint)WMsg.WM_KEYUP, vk, makeLp(vk, WMsg.WM_KEYUP)); break; case RingPstType.down: User32.PostMessageA(hwnd, (uint)WMsg.WM_KEYDOWN, (int)vk, makeLp(vk, WMsg.WM_KEYDOWN)); break; case RingPstType.up: User32.PostMessageA(hwnd, (uint)WMsg.WM_KEYUP, (int)vk, makeLp(vk, WMsg.WM_KEYUP)); break; } }
/// <summary>Is called when a virtual key is pressed.</summary> /// <param name="key">The virtual key that was pressed.</param> public void KeyDown(VirtualKeys key) { // TODO: Your old KeyDown code goes here. }
/// <summary>Is called when a key is pressed.</summary> /// <param name="key">The key.</param> internal void KeyDown(VirtualKeys key) { if (key == VirtualKeys.D) { // --- enable safety systems --- if (this.AtsSx != null) { if (this.AtsSx.State == AtsSx.States.Disabled) { this.AtsSx.State = AtsSx.States.Suppressed; } } if (this.AtsP != null) { if (this.AtsP.State == AtsP.States.Disabled) { this.AtsP.State = AtsP.States.Suppressed; } } if (this.Atc != null) { if (this.Atc.State == Atc.States.Disabled) { this.Atc.State = Atc.States.Suppressed; } } } else if (key == VirtualKeys.E) { // --- disable safety systems --- if (this.AtsSx != null) { if (this.AtsSx.State != AtsSx.States.Disabled) { this.AtsSx.State = AtsSx.States.Disabled; } } if (this.AtsP != null) { if (this.AtsP.State != AtsP.States.Disabled) { this.AtsP.State = AtsP.States.Disabled; } } if (this.Atc != null) { if (this.Atc.State != Atc.States.Disabled) { this.Atc.State = Atc.States.Disabled; } } } else { // --- other functions --- foreach (Device device in this.Devices) { device.KeyDown(key); } } }
/// <summary>Is called when a key is released.</summary> /// <param name="key">The key.</param> internal override void KeyUp(VirtualKeys key) { }
public static bool GetState(VirtualKeys Key) { return (GetKeyState((int)Key) == 1); }
private extern static short Win32GetKeyState(VirtualKeys nVirtKey);
/// <summary>Called when a virtual key is released.</summary> internal abstract void KeyUp(VirtualKeys key);
internal virtual bool IsKeyLocked (VirtualKeys key) { return false; }
private void SetState (VirtualKeys key, bool state) { if (VirtualKeys.VK_NUMLOCK == key) num_state = state; else cap_state = state; }
public static extern short GetAsyncKeyState(VirtualKeys vKey);
private void GenerateMessage (VirtualKeys vkey, int scan, int key_code, XEventName type, int event_time) { bool state = (vkey == VirtualKeys.VK_NUMLOCK ? num_state : cap_state); KeybdEventFlags up, down; if (state) { // The INTERMEDIARY state means : just after a 'press' event, if a 'release' event comes, // don't treat it. It's from the same key press. Then the state goes to ON. // And from there, a 'release' event will switch off the toggle key. SetState (vkey, false); } else { down = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey : KeybdEventFlags.None); up = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey : KeybdEventFlags.None) | KeybdEventFlags.KeyUp; if ((key_state_table [(int) vkey] & 0x1) != 0) { // it was on if (type != XEventName.KeyPress) { SendKeyboardInput (vkey, scan, key_code, down, event_time); SendKeyboardInput (vkey, scan, key_code, up, event_time); SetState (vkey, false); key_state_table [(int) vkey] &= unchecked ((byte) ~0x01); } } else { if (type == XEventName.KeyPress) { SendKeyboardInput (vkey, scan, key_code, down, event_time); SendKeyboardInput (vkey, scan, key_code, up, event_time); SetState (vkey, true); key_state_table [(int) vkey] |= 0x01; } } } }
private MSG SendKeyboardInput (VirtualKeys vkey, int scan, int keycode, KeybdEventFlags dw_flags, int time) { Msg message; if ((dw_flags & KeybdEventFlags.KeyUp) != 0) { bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 && ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0); key_state_table [(int) vkey] &= unchecked ((byte) ~0x80); message = (sys_key ? Msg.WM_SYSKEYUP : Msg.WM_KEYUP); } else { if ((key_state_table [(int) vkey] & 0x80) == 0) { key_state_table [(int) vkey] ^= 0x01; } key_state_table [(int) vkey] |= 0x80; bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 && ((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0); message = (sys_key ? Msg.WM_SYSKEYDOWN : Msg.WM_KEYDOWN); } MSG msg = new MSG (); msg.message = message; msg.wParam = (IntPtr) vkey; msg.lParam = GenerateLParam (msg, keycode); return msg; }
public static void SetState(VirtualKeys Key, bool State) { if (State != GetState(Key)) { keybd_event( (byte)Key, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 ); keybd_event( (byte)Key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 ); } }
/// <summary>Is called when a virtual key is released.</summary> /// <param name="key">The virtual key that was released.</param> public void KeyUp(VirtualKeys key) { // TODO: Your old KeyUp code goes here. }
internal static extern SHORT GetKeyState(VirtualKeys vKey);
internal override bool IsKeyLocked (VirtualKeys key) { return (Win32GetKeyState (key) & 1) == 1; }
internal static extern UINT MapVirtualKey(VirtualKeys vkey, MapVirtualKeyType uMapType);
/// <summary>Called when a virtual key is pressed.</summary> internal abstract void KeyDown(VirtualKeys key);
internal override void KeyDown(VirtualKeys key) { }
/// <summary>Is called when a key is pressed.</summary> /// <param name="key">The key.</param> internal override void KeyDown(VirtualKeys key) { switch (key) { case VirtualKeys.A2: // --- acknowledge the EB --- if (this.Counter >= TimeUntilBell) { this.Counter = 0.0; } break; } }
static extern short GetKeyState(VirtualKeys nVirtKey);
internal static bool IsKeyLocked (VirtualKeys key) { #if DriverDebug || DriverDebugState Console.WriteLine ("IsKeyLocked ({0}): Called, Result={1}", key, driver.IsKeyLocked (key)); #endif return driver.IsKeyLocked (key); }