Link to home
Start Free TrialLog in
Avatar of millweb
millweb

asked on

C# - Creating a Global Windows Keyboard Shortcut

Hello,

For our office management application, we wish to have a global Windows shortcut to perform particular actions in our program.  Most specifically, to open a new Form to interact with the user.

By comparison, we wish to function much like the Google Desktop application -- whereby pressing "Control, Control" will cause a new window / Form to appear on the user's screen, and prompt them for a search query.

Please indicate how a Windows-wide shortcut can be made, instead of just an application-specific keyboard shortcut.

Thank you in advance.
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

I don't belive the framework has this built into managed code yet. If it does I couldn't find it but there is a couple different ways you can do this using Pinvoke.
RegisterHotKey
http://msdn.microsoft.com/en-us/library/ms646309(VS.85).aspx
GetAsyncKeyState
http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx

 
Avatar of Mike Tomlinson
You can use a low level keyboard hook via WH_KEYBOARD_LL:
http://www.codeproject.com/KB/cs/globalhook.aspx
ASKER CERTIFIED SOLUTION
Avatar of systan
systan
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial