开发者

How can I make my program execute a function from a keyboard shortcut?

开发者 https://www.devze.com 2022-12-21 13:07 出处:网络
How can I do it, even if my application.exe is not the focused windo开发者_高级运维w ? For example, like the Windows+D shortcut... Works everywhere...

How can I do it, even if my application.exe is not the focused windo开发者_高级运维w ?

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...


You mean like this?


You need to use pyHook.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消