Global hotkeys in WPF?

五迷三道 提交于 2020-01-03 03:06:05

问题


I've build a WPF application and want to add global hotkey support. I want to be able to execute a method in my application from anywhere in windows, even when my application is minimized or running in tray. For example, execute the method with ctrl + alt + t.

Is this possible in WPF, and if so, how?


回答1:


You need to take a look at RegisterHotKey in user32.dll. Here's a good example at pinvoke.net: http://www.pinvoke.net/default.aspx/user32/RegisterHotKey.html



来源:https://stackoverflow.com/questions/4489118/global-hotkeys-in-wpf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!