/// <summary> /// Create a new KeyboardHookEventArgs for a key and modifier /// </summary> /// <param name="key"></param> /// <param name="modifier"></param> public KeyboardHookEventArgs(Keys key, WinAPI.KeyModifiers modifier) { this.Key = key; this.Modifiers = modifier; this.Alt = (modifier & WinAPI.KeyModifiers.Alt) != 0; this.Control = (modifier & WinAPI.KeyModifiers.Control) != 0; this.Shift = (modifier & WinAPI.KeyModifiers.Shift) != 0; }
/// <summary> /// Create the new item /// </summary> /// <param name="key"></param> public KeyItem(WinAPI.VirtualKeyCode key) { Key = key; }
/// <summary> /// Check if a specified Hotkey is available /// </summary> /// <param name="form">owning form</param> /// <param name="key">hot key Key</param> /// <param name="modifier">hoy key Modifier</param> /// <returns>true if available</returns> public static bool IsHotkeyAvailable(Form form, Keys key, WinAPI.KeyModifiers modifier) { bool available = WinAPI.RegisterHotKey(form.Handle, 0, modifier, key); if (available == true) { WinAPI.UnregisterHotKey(form.Handle, 0); } return available; }