简体   繁体   中英

How to make global keyboard hook for key combinations?

I'm using it to make global keyboard hook. There are such lines :

gkh.HookedKeys.Add(Keys.A);
gkh.HookedKeys.Add(Keys.B);

to register hooked hotkeys. How to modify that solution to make hook for combination, for example A+B, but not single A or B?

The standard solution for global hotkeys is the RegisterHotkey API. It supports hotkeys with modifiers (Control, Shift, Alt, Windows) out of the box, and doesn't suffer from the global side effects of a hook.

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