Global Hotkeys - C#
-
01-06-2021 - |
Question
I have built an application which listens for a global hot key (Alt + Space currently), when I press the hot key when Google Chrome is in focus it brings my app to focus but also opens Chrome's context menu (right click menu). I used the following dll for implementing the keyboard hook.
Can I prevent this from happening? If so how? This isn't a major problem but if there is a way in which you can clear all existing hot keys tied to that combination then I'd like to learn this.
EDIT
The answer that I selected as being the correct one, is the correct one but for my problem. To correctly implement this feature into a C# WinForm i used this tutorial which was very helpful: http://www.dreamincode.net/forums/topic/180436-global-hotkeys/
Solution
The FAQ section of the linked article contains your answer:
Question
I need to suppress some keystrokes after I have processed them.
Answer
Just set the
e.Handled
property totrue
in the key events you have processed. It prevents the keystrokes being processed by other applications.