/// <summary> /// Register the hotkey combination. /// </summary> /// <param name="keyModifier"></param> /// <param name="key"></param> public bool RegisterHotKey(Win32Helper.KeyModifier keyModifier, Key key) { Win32Helper.UnregisterHotKey(_hWnd, 1); bool ret = Win32Helper.RegisterHotKey(_hWnd, 1, (uint)keyModifier, (uint)KeyInterop.VirtualKeyFromKey(key)); if (ret) { _modifier = keyModifier; _vKey = key; SaveHotKey(); } return(ret); }
private void On_MenuItem_Exit_Click(object sender, EventArgs e) { if (_winTray != null) { _winTray.TrayIcon.Dispose(); } if (_hwndSrc != null) { bool ret = Win32Helper.UnregisterHotKey(_hwndSrc.Handle, 1); //Remove Clipboard listener. Win32Helper.RemoveClipboardFormatListener(_hwndSrc.Handle); } _shutdown = true; System.Windows.Application.Current.Shutdown(); }
/// <summary> /// Unregister the hotkey combination. /// </summary> public bool UnRegisterHotKey() { bool ret = Win32Helper.UnregisterHotKey(_hWnd, 1); return(ret); }