The difference between thread-specific hooks and global hooks

Source: Internet
Author: User
Tags message queue
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.