Programming a hotkey utility

150 Views Asked by At

I've got a project, where I need to use hotkeys, that would work globally through the whole Windows OS. Now, from my knowledge I only know how to read Key events on current form. How would I go about programming a hotkey utility? And what would be the best language for it?

Thanks

2

There are 2 best solutions below

2
On BEST ANSWER

For C#/.Net and a low-level hook (using Interops), have a look at Stephen Toubs example here (complete with source):

Low-Level Keyboard Hook in C#

For a more complete example (also C#/.Net and Interops), but with everthing neatly contained in a separate class, including trapping key presses using normal Events on the client side, check this out (the link to the actual source is in the blog text, a bit tricky to spot):

Global hotkeys with .NET

0
On

are you looking for something like this. even vhen the program is not active it should respond for a key press. in windows,

#include<windows.h>
if(GetAsyncKeyState(0x41)){
     //do somethong here
 }

note: refer virtual key stats http://msdn.microsoft.com/en-us/library/ms927178.aspx