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.
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.
You can use a low level keyboard hook via WH_KEYBOARD_LL:
http://www.codeproject.com/KB/cs/globalhook.aspx
http://www.codeproject.com/KB/cs/globalhook.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi,
See the reference ,
http://gaurav-kalra.spaces.live.com/blog/cns!763BFEA85DD32432!219.entry
KeyboardHook.cs
Program.cs
See the reference ,
http://gaurav-kalra.spaces.live.com/blog/cns!763BFEA85DD32432!219.entry
KeyboardHook.cs
Program.cs
RegisterHotKey
http://msdn.microsoft.com/en-us/library/ms646309(VS.85).aspx
GetAsyncKeyState
http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx