Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C# - Creating a Global Windows Keyboard Shortcut

Posted on 2010-08-29
4
Medium Priority
?
785 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 86

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 2000 total points
ID: 33554315
0
 
LVL 4

Expert Comment

by:Veerabhadraiahhv
ID: 33557581
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

972 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