I'm going to make a MFC application that will use hotkeys.
I understand the RegisterHotkey() function, I am just a little confused on the Binding process.
I've got an edit box (readonly) right next to a button that says "Set Key Binding". When the user presses that button, it will change the edit box to say "Press a Key" and the button will say "Cancel Key Binding". The user than can enter any one of the 255 VKeys (including left mouse) however, if the user presses left mouse on the button that cancels the binding, it won't register it.
I've currently got a very crude version working. Basically, when the user presses the button, a for loop starts (goes from 1-255) checking for GetAsyncKeyState ( i ). This goes on until a key is pressed.
The limitations of my version:
- Freeze the MFC window until a key is pressed
- Doesn't allow for changing of the text on the button or the edit box
- Makes my antivirus think my program is a keylogger =D
- Uses all of my CPU
- Allows for only ONE keypress (no ALT+F5 stuff, just ALT or F5)
I'm hoping there's another way (similar to the way Xfire does it).
Thanks in advance,