如何使我的程序通过键盘快捷键执行功能?
即使我的 application.exe 不是焦点窗口,我该怎么办?
例如,像 Windows+D 快捷方式...到处都可以使用...
我想要 ALT+1 执行一项功能,ALT+2 执行另一项功能,依此类推...
How can I do it, even if my application.exe is not the focused window ?
For example, like the Windows+D shortcut... Works everywhere...
I want that ALT+1 does a function, ALT+2 does another one, and so on...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的意思是像这个?
You mean like this?
您需要使用 pyHook。
You need to use pyHook.
我的网站上有一个 pyHook 示例。 http://fadedbluesky.com/2011/using-pyhook-to- block-windows-key/
我最初写这个是为了阻止使用 pygame 编写的游戏中的按键。您应该能够轻松地将其适应其他 Windows 程序。
I have a pyHook example on my site. http://fadedbluesky.com/2011/using-pyhook-to-block-windows-key/
I originally wrote this to block keys in a game written using pygame. You should be able to easily adapt it to other windows programs.