[RESOLVED] Keystrokes Catcher?
Hello guys,
I just wanted to know how do I implement stuffs like this.
I am making a software where it will catch a keystrokes, take note. Not a Keylogger
it will be running on the Background, like it will be minimized to System Tray
then for example a combination keys like Ctrl Shift F or Ctrl Shift (a certain key)
then the software will react to the keystrokes..
Anyone can help? Thanks
Re: [RESOLVED] Keystrokes Catcher?
That is absolutely not the way to do it. How is it that I say that you should use the RegisterHotkey API, you say thanks and end up not using it? DO NOT use GetAsyncKeyState for this. Use RegisterHotKey
Re: [RESOLVED] Keystrokes Catcher?
oh sorry, but this solved my problem though the keyword "hotkey" :D
Re: [RESOLVED] Keystrokes Catcher?
You may think that it solved your problem but it didn't. That code is inefficient at best and has a big hole in it at worst. I specifically said:
Quote:
use the RegisterHotKey API
What you do is up to you but that is the proper way to do what you want to do, which is why I suggested it. It overcomes both issues with the code you are now using.
Re: [RESOLVED] Keystrokes Catcher?
Re: [RESOLVED] Keystrokes Catcher?
Please do not use GetAsyncKeyState. I am quite confused how you searched for Register Hotkey API and got GetAsyncKeyState. You are forcing your application to check ever N seconds for a key stroke. Even more so on the UI thread. Your application will be amazing slow.
Register HotKey API Source
Also if you really are interested in learning take the time to read:
RegisterHotKey Function
WM_HOTKEY message