Solved

C# - Creating a Global Windows Keyboard Shortcut

Posted on 2010-08-29
4
746 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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now