How to connect to double-clicking the Ctrl key?

I am looking for functionality similar to the Google desktop. When you double-click Ctrl, a small search box will appear.

I tried using a rather heavy keyboard class for the keyboard, which I found somewhere, but this all the time gave me unpredictable results (i.e. the first time it would work, then I would press Ctrlonce, and it will raise the pressed event key a few time?).

In any case, it just doesn't seem like it should be complicated, so I feel like I should be doing something wrong. My application (WPF application) will be launched with the visibility of the main window, hidden and not in the taskbar. When I execute Ctrl- CtrlI want to catch him and show the window.

Another problem is that I am doing this now by registering a hotkey, but this does not give me the full functionality that I want (double tap Ctrl). When the window is displayed, I did not find a 100% way to check when it no longer has focus (I want to hide it again when this happens). I tried to respond to Deactivated, LostFocus, etc., and they work most of the time. But sometimes it seems that the window is displayed without actually activating or getting focus. Any ideas on this?

Thanks!
Adam

+3
source share
2 answers

, SetWindowsHookEx, .

++, pinvoke.net, #.

#, , CodeProject. . - Jad Engine, (UserActivityHook), , . ...

+3

, , , Form.Activate . GotFocus, LostFocus, Enter, Exit Activate, , .

+2

Source: https://habr.com/ru/post/1710203/


All Articles