创建与WPF C#背景热键的正确方法? (最好不使用旧代码) [英] Proper way of creating a background hotkey with WPF C#? (preferably without using legacy code)

查看:173
本文介绍了创建与WPF C#背景热键的正确方法? (最好不使用旧代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够建立一个背景热键事件WPF应用程序。 (由后台我的意思是有问题的应用程序可能没有必要成为市场关注焦点)。

I need to be able to set up a background hotkey event for a WPF application. (by background I mean that the application in question might not necessary be in focus).

我知道,与WinForms的做这将是进口user32.dll中,并使用RegisterHotKey的正确方法,并渔获适当WM_POST消息。我相信,必须有与WPF一个更好的解决方案,然后使用user32.dll中,但我一直无法找到任何东西。有什么建议么?谢谢

I know that with WinForms the proper way of doing it would be to import user32.dll, and use RegisterHotKey, and the catch the appropriate WM_POST message. I'm convinced that there has to be a better solution with WPF, then using user32.dll, but I have been unable to find anything. Any suggestions? Thanks

推荐答案

我不认为WPF已任为热键支持内置,至少我找不到任何和我二手RegisterHotKey直接。

I don't think WPF has any built in support for hotkeys, at least I couldn't find any and I used RegisterHotKey directly.

这篇关于创建与WPF C#背景热键的正确方法? (最好不使用旧代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆