Nostalgia .Net • Hot Keys

System-Wide Hot Keys Component


This component supports system-wide hot keys and allow to register and unregister shortcuts and track hot key pressing. To use just register shortcut as new hot key:

    RegisterKey(Keys Key, bool Control, bool Alt, bool Shift, bool Win)
This method returns new hot key identifier. If returned value is 0, registration is failed (usually this means that this shortcut is already registered in the system), otherwise returned value is new hot key identifier that can be used in HotKeyPressed event and must be passed into UnregisterKey method for unregistering.

When hot key is pressed, the HotKeyPressed event occurs, and this event's parameter contains hot key identifier, the key and boolean flags for each modifier (Ctrl, Alt, Shift and Win):

    private string KeyString(Keys key, bool Control, bool Alt, bool Shift, bool Win)
    {
      string result = key.ToString();
      if (Win) result = "Win+" + result;
      if (Shift) result = "Shift+" + result;
      if (Alt) result = "Alt+" + result;
      if (Control) result = "Control+" + result;
      return result;
    }

    private void hotKeys_HotKeyPressed(object sender, HotKeyEventArgs e)
    {
      MessageBox.Show(KeyString(e.Key, e.Control, e.Alt, e.Shift, e.Win));
    }
Demo project shows everything about HotKey component:

Hot Keys Demo


Download free trial version
Order Nostalgia .Net right now!