/// <summary>
        /// Registers the hot key.
        /// </summary>
        /// <param name="keyCategory">The key category.</param>
        /// <param name="key">The key.</param>
        public void RegisterHotkey(KeyCategories keyCategory, Keys key)
        {
            if (_isHotkeySet)
            {
                UnregisterHotkey();
            }

            _isHotkeySet = NativeMethods.RegisterHotkey(this, keyCategory, key);
        }
Exemple #2
0
        /// <summary>
        /// Registers the hot key.
        /// </summary>
        /// <param name="keyCategory">The key category.</param>
        /// <param name="key">The key.</param>
        public void RegisterHotkey(KeyCategories keyCategory, Keys key)
        {
            // TODO: Make this call a single parameter call with "Keys" as the param.

            if (_isHotkeySet)
            {
                UnregisterHotkey();
            }

            _isHotkeySet = NativeMethods.RegisterHotkey(this, keyCategory, key);
        }
Exemple #3
0
        /// <summary>
        /// Registers the hot key.
        /// </summary>
        /// <param name="keyCategory">The key category.</param>
        /// <param name="key">The key.</param>
        public void RegisterHotkey(KeyCategories keyCategory, Keys key)
        {
            // TODO: Make this call a single parameter call with "Keys" as the param.

            if (_isHotkeySet)
            {
                UnregisterHotkey();
            }

            _isHotkeySet = NativeMethods.RegisterHotkey(this, keyCategory, key);
        }
 /// <summary>
 /// Registers the hotkey.
 /// </summary>
 /// <param name="container">The container.</param>
 /// <param name="category">The category.</param>
 /// <param name="key">The key.</param>
 /// <returns></returns>
 public static bool RegisterHotkey(Control container, KeyCategories category, Keys key)
 {
     return(RegisterHotKey(container.Handle, UniqueHotkeyId, category, key));
 }
 private static extern bool RegisterHotKey(IntPtr hWnd, int id, KeyCategories fsModifiers, Keys vk);
 private static extern bool RegisterHotKey(IntPtr hWnd, int id, KeyCategories fsModifiers, Keys vk);
        private const int UniqueHotkeyId = 100; //  ...has to be unique for the calling thread

        #endregion Fields

        #region Methods

        /// <summary>
        /// Registers the hotkey.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="category">The category.</param>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public static bool RegisterHotkey(Control container, KeyCategories category, Keys key)
        {
            return RegisterHotKey(container.Handle, UniqueHotkeyId, category, key);
        }