How can I create an application that performs an action with keyboard shortcut (App must be unvisible). For example Shows MessageBox when user press Ctrl + Alt + W.
How can I create an application that performs an action with keyboard shortcut (App
Share
One solution would be to use interop and use the Win32 RegisterHotKey API. Here is a quick and dirty example I just put together so it is not well tested and I am not sure that there are no unexepcted side effects, but it should work.
First here is a simple
HotKeyManagerthis takes care of the basic interop, provides a hidden window to handle the native Windows messages (WM_HOTKEY) which is translated into a .NET eventHotKeyPressedThe following shows a simple windows forms application which will keep the main form hidden and respond to the hot key events. I did not handle the closing of the application and the unregistering of the hot key, you can handle that.