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

问题描述:

可能重复:结果
  How我可以注册一个全局热键说CTRL + SHIFT +使用WPF和.NET 3.5(LETTER)?

我想有多个全局热键在我的新的应用程序(控制从窗户任何地方的应用程序),以及所有给定的来源/解决方案,我发现在网络上似乎有一个排序一瘸一拐的解决方案提供(无论是解决方案只为一个g.hotkey,或解决方案,同时运行在屏幕上创建恼人的鼠标延时)。

I'd like to have multiple global hotkeys in my new app (to control the app from anywhere in windows), and all of the given sources/solutions I found on the web seem to provide with a sort of a limping solution (either solutions only for one g.hotkey, or solutions that while running create annoying mouse delays on the screen).

在这里有谁知道一种资源,可以帮助我achive这一点,我可以借鉴?
什么?

Does anyone here know of a resource that can help me achive this, that I can learn from? Anything?

谢谢! :)

我已经找到了最好的解决方案是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