lenden
lenden

Reputation: 830

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?

Upvotes: 1

Views: 2053

Answers (1)

CodesInChaos
CodesInChaos

Reputation: 108880

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.

Upvotes: 1

Related Questions