简体   繁体   中英

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

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

你的意思是这样的?

你需要使用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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM