Project DescriptionA .NET (C#) library to register and handle the system hot keys.
处理系统热键(系统快捷键)的 .NET 类库。
Easy System Hot Keys Control in WinFormSample code:
private SystemHotKeyListener _hotKeyListner = null;
private void Form1_Load(object sender, EventArgs e)
{
// Initialize the SystemHotKeyListener.
_hotKeyListner = new SystemHotKeyListener(this);
// Attach the event processing procedure.
_hotKeyListner.SystemHotKeyPressed +=
new EventHandler<SystemHotKeyPressedEventArgs>(_hotKeyListner_SystemHotKeyPressed);
// Create a hot key (Windows Logo key + Esc)
HotKey testHotKey = new HotKey("TEST", KeyModifiers.Windows, Keys.Escape);
// Register this hot key.
_hotKeyListner.Register(testHotKey);
}
void _hotKeyListner_SystemHotKeyPressed(object sender, SystemHotKeyPressedEventArgs e)
{
switch (e.HotKeyName)
{
case "TEST":
MessageBox.Show("The Windows Logo + Esc key was pressed.");
break;
}
}