I tried to create an application in c++ that sets a low level keyboard hook and each time the user presses a key it will write a char of a string I made.
Can someone explain how can I change the user input without using the keybd_event function but changing the key itself before the OS interprets it.
I tried something with ths MSG and changing the wparam but it didn't work. If someone can show me a code example it will be better
You cannot. You have to reject the key inyour hook and then post your own key using
keybd_event()
orSendInput()
. And be sure to check if theKBDLLHOOKSTRUCT::flags
field has theLLKHF_INJECTED
orLLKHF_LOWER_IL_INJECTED
flag enabled so you don't reject your own simulated keys.The
MSG
structure is not used with aWH_KEYBOARD_LL
hook.