コード例 #1
0
ファイル: ApiHotkeyManager.cs プロジェクト: xyx0826/Priceall
        /// <summary>
        /// Registers a hotkey to Windows hotkey table.
        /// </summary>
        /// <param name="hk">The hotkey to register.</param>
        /// <returns>Whether the registration is successful.</returns>
        private static bool RegisterHotkey(Hotkey hk)
        {
            if (_windowHandle == IntPtr.Zero)
            {
                throw new InvalidOperationException("The window handle is not initialized.");
            }

            return(HotkeyInterop.RegisterHotKey(_windowHandle, hk.Id, hk.KeyCombo.ModifierKeys,
                                                KeyInterop.VirtualKeyFromKey(hk.KeyCombo.Key)));
        }
コード例 #2
0
ファイル: ApiHotkeyManager.cs プロジェクト: xyx0826/Priceall
 /// <summary>
 /// Removes a hotkey from Windows hotkey table.
 /// </summary>
 /// <param name="hk">The hotkey to unregister.</param>
 /// <returns>Whether the unregistration is successful.</returns>
 private static bool UnregisterHotkey(Hotkey hk)
 {
     return(HotkeyInterop.UnregisterHotKey(_windowHandle, hk.Id));
 }