Solved

C# - Creating a Global Windows Keyboard Shortcut

Posted on 2010-08-29
4
761 Views
Last Modified: 2013-12-17
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.
0
Comment
Question by:millweb
4 Comments
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 33553552
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

 
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 33553577
You can use a low level keyboard hook via WH_KEYBOARD_LL:
http://www.codeproject.com/KB/cs/globalhook.aspx
0
 
LVL 14

Accepted Solution

by:
systan earned 500 total points
ID: 33554315
0
 
LVL 4

Expert Comment

by:Veerabhadraiahhv
ID: 33557581
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question