且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C#中解决全局热键处理的***方式?

更新时间:2022-02-14 01:22:46

我已经找到了***的解决方案是http://bloggablea.word$p$pss.com/2007/05/01/global-hotkeys-with-net/

The nicest solution I've found is http://bloggablea.wordpress.com/2007/05/01/global-hotkeys-with-net/

Hotkey hk = new Hotkey();

hk.KeyCode = Keys.1;
hk.Windows = true;
hk.Pressed += delegate { Console.WriteLine("Windows+1 pressed!"); };

hk.Register(myForm); 

请注意如何设置不同的lambda表达式到不同的热键

Note how you can set different lambdas to different hotkeys