how do i detect the state (up, down) of a given key and/or mouse button, no matter which program is in focus?
thanks
in c++ how do i detect the state of a given key no mater wha
Re:in c++ how do i detect the state of a given key no mater
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_
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
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
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...