Exemple #1
0
        private void RegisterHotKey(Keys key, Win32Api.user32.KeyModifiers modifier)
        {
            if (key == Keys.None)
            {
                return;
            }

            bool isKeyRegisterd = Win32Api.user32.RegisterHotKey(handle, id, modifier, key);

            if (!isKeyRegisterd)
            {
                throw new ApplicationException("Hotkey allready in use");
            }
        }
Exemple #2
0
 public HotKey(Keys key, Win32Api.user32.KeyModifiers modifier)
 {
     RegisterHotKey(key, modifier);
     Application.AddMessageFilter(this);
 }