Application Level Key Shortcut
-
Hi, Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?
-
Hi, Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?
You can use the
PreviewKeyDown
event to see what key is pressed at theForm
level.The difficult we do right away... ...the impossible takes slightly longer.
-
You can use the
PreviewKeyDown
event to see what key is pressed at theForm
level.The difficult we do right away... ...the impossible takes slightly longer.
-
Hi, Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?
-
Hi, Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?
Yes, it is, but you will have to go on treacherous ground to do so (needs some unmanaged code). Take a look at keyboard hooks, more specifically
RegisterHotKey
andUnregisterHotKey
, both fromuser32.dll
. Google it further, there are a lot of threads detailing how this can be achieved, for instance here[^], or here[^]Full-fledged Java/.NET lover, full-fledged PHP hater. Full-fledged Google/Microsoft lover, full-fledged Apple hater. Full-fledged Skype lover, full-fledged YM hater.
-
Hi, Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?