Search code examples
c#winformswinapic#-4.0winforms-interop

How to detect the ctrl key is pressed twice if the program is minimized or in system tray


How to detect the ctrl key is pressed twice if the program is minimized or in system tray

I am trying to develop a c# program where the main form will be shown to the user when the control key is pressed twice. I found samples for hotkey combinations but this is not hotkey with combination, like control+ some other key. This is like google desktop app where the search box is displayed when control key is pressed twice.


Solution

  • Keyboard hooking as suggested. It's been nicely wrapped for you at CodePlex, where you get a .NET API simply raising Key and Mouse events, regardless of the state your app is in.