Contiune keyboard working while hooking
Contiune keyboard working while hooking
I'm learning recently how to hook APIs and I started with keyboard calls. I set the hook with
"SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, 0, 0);"
and everything is working as i want but...
Hooking is capturing keyboard and kinda blocking it - so as i want only to get informations that keys are used but dont wanna change the way they'r working i used
"keybd_event(p->vkCode, 0, 0, 0);"
and here appears another "but"... This function as it's simulation of key press it going to be hooked again what i do NOT want.
Is there any solution to get information about keyboard using without blocking the work of it?
WH_KEYBOARD_LL
DO NOT call
keybd_event()
from inside the hook. Let the hook do what it needs and then call CallNextHookEx()
before exiting, and the key event will be delivered to the target normally. And FYI, the info that WH_KEYBOARD_LL
gives you tells you whether the key event was simulated or not, so you can ignore events from keybd_event()
and SendInput()
– Remy Lebeau
Jun 29 at 9:35
keybd_event()
CallNextHookEx()
WH_KEYBOARD_LL
keybd_event()
SendInput()
im stupid... Thanks a lot @RemyLebeau ;) it's working perfectly... i had "short if" in return with CallNextHookEx() and i suppose it didnt get to NextHook ;)
– Jan Maciołka
Jun 29 at 9:39
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
WH_KEYBOARD_LL
not blocking keyboard– RbMm
Jun 29 at 9:06