Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to understand which hook is used for what purpose.


What I have tried:

I have googled and only difference I understood is WH_KEYBOAD will inject the dll into the processes but for the WH_KEYBOAD_LL windows will make a direct call to call back function without injecting the dll.

So my question is, will both the hooks do the same functionality or is there any difference between . It will be helpful if you can give an example for both the hooks?
Posted
Updated 7-Apr-20 5:56am

 
Share this answer
 
Comments
Coder969 16-Sep-19 7:52am    
Thanks for the response. I read the point but still I am not able to understand the difference. What is the difference between message queue and thread input queue. Can you explain the use case when to use which hook?
Richard MacCutchan 16-Sep-19 8:03am    
The explanations are there in the links. The _LL suffix is for the low level hook which catches all activities before the key status is updated. The WH_KEYBOARD hook just catches simple keyup and keydown events. The thread input queue is merely the queue where the messages are placed before being extracted by the application code. You can request messages belonging to a specific thread by putting its id in the MSG structure.
Coder969 16-Sep-19 8:16am    
Thanks for explanation . From your comment I understood that WH_KEYBOARDHOOK_LL provides more information compare to WH_KEYBOARDHOOK.

My requirement is to log to a file whenever 'Enter' key is pressed. Which hook is better to use?
Richard MacCutchan 16-Sep-19 8:40am    
Use WH_KEYBOARDHOOK as you are only interested in the key being pressed.
Coder969 16-Sep-19 8:42am    
Thanks :)
how i can trace application name or browser url where typing something??
Example if i a\m typing on word then it will return word if it will a exe file then exe file name?? Any suggestion

Thankls in Advance
 
Share this answer
 
Comments
Richard MacCutchan 7-Apr-20 12:15pm    
"Any suggestion"
Don't post questions as Solutions to existing QA entries.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900