How can I listen in on shortcuts when the app is the task bar in C#
-
09-06-2019 - |
Question
An example of an app that does this is Enso, it pops up when you press the caps lock.
Solution
You can act on global hotkeys by calling the winapi function RegisterHotKey. Also see http://www.codeproject.com/KB/vb/mclhotkeynet.aspx and http://www.codeproject.com/KB/miscctrl/systemhotkey.aspx for example. You can not use all key combination as hotkeys. For those that don't work you might try a global keyboard hook (SetWindowsHookEx)
OTHER TIPS
You need to install a hook in user32.dll. Lookup the Win32-API call SetWindowsHookEx. You can call it from C# via the stuff in System.Runtime.InteropServices.
This article discusses the topic nicely.
Edit: Lars Truijens answer looks like a nicer approach actually.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow