is actually the difference between the global and the local
If it is possible to use thread hooks, it is best to use thread hooks
Because the hook technology is not good enough to greatly reduce the performance of the entire Windows system
That's why wince doesn't support hooks.
As for the keyboard hook with SetWindowsHookEx with Wh_keyboard parameters can be
For example, you make a global keyboard hook so that whatever application is currently active
Whenever you have a keyboard message, Windows will ask your hook Proc first,
"Old, how about this key?" ”
You're done with your hook proc, take it to the left and look right.
Finally said
"Gee, I don't want this key, give it to you."
You say tired not tired ah.
Message Queuing is thread-based. A local hook hook is a message for all threads in a process.
This type of implementation is a light-weight hook because it does not involve a process context switch.
The global hooks are mapped to all processes that load USER32.DLL, in fact USER32.DLL call LoadLibrary for these processes to load the DLL where the hook is located.
and call HookProc before all messages are sent to message processing. When HookProc decides that the message has been processed, the message is removed from the thread message queue.
The invocation of the HookProc itself is based on the order of the loaded sequence from the back to the front.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The difference between thread-specific hooks and global hooks