Page 1 of 1
in c++ how do i detect the state of a given key no mater wha
Posted: Sat Sep 06, 2003 8:15 pm
by Scarberry
how do i detect the state (up, down) of a given key and/or mouse button, no matter which program is in focus?
thanks
Re:in c++ how do i detect the state of a given key no mater
Posted: Sun Sep 07, 2003 4:54 am
by anubis
Thinking that u r using widows as ur development environment. U can use the SetWindowsHookEx() function to trap the user inputs and then check for the states.
Check
THIS for more info on hooks. Or u can always search for hooks in MSDN.
Hope that it helps.
_Anubis_
Re:in c++ how do i detect the state of a given key no mater
Posted: Sun Sep 07, 2003 10:26 pm
by ark
My memory on this is a little rusty, so I'm not 100% sure about this, but depending on your needs GetAsyncKeyState may also be easier than using a keyboard hook.
Re:in c++ how do i detect the state of a given key no mater
Posted: Fri Oct 24, 2003 12:59 am
by Ozguxxx
getasynckeystate uses lots of cpu time, assuming you are implementing a keylogger, your program will be detectable... Hooking is much more useful, and in some sense it is much more easier and also you can never leave a key behind with hooking...