Finding out which key has been pressed on keyboard
I'm trying to set up a global hot key, and I want to give the users of the app the ability specify their own key combo for the hotkey.
My problem is that I haven't been able to find a way to loop through the virtual keys to find out which one is pressed...
examples show doing
if (e.control && e.a) in the keydown event for a textbox... But how can I loop through each key to find out which one is which?
My goal is to:
A. Give the user the ability to set their own hot key (1 to 2 keys - can either be as simple as "shift" or it can be "shift+a")
B. Display in the text box an understandable meaning (left Shift + Right)
C. Do what ever to convert it to a system wide hot-key (Main purpose of the program is to play a sound when ever the hot key is pressed, and then another one when it is released).
I have been searching this out for weeks and keep coming up short - only way I can see doing this is to check specificaly for every key on the keyboard using an if statement..
Thanks,
Seth
|