zoukankan      html  css  js  c++  java
  • 钩子教程

    原文地址:http://www.zdexe.com/program/201004/577.html

    勿在浮沙筑高台。继续学习。今天主要学习官方的资料。但是查找到的都是E文,俺只是翻译了一下。全部查找自msdn。

    Hooks tend to slow down the system because they increase the amount of processing the system must perform for each message. You should install a hook only when necessary, and remove it as soon as possible.

    我将其翻译过来意思就是:

    系统必须要处理每个消息,而钩子的使用增加了系统对每个消息要执行的处理的数量,因此,钩子会减慢系统。应该仅仅在必须的时候才安装钩子,并且尽可能早的将其卸载掉。

    Hook Chain(钩子链表)

    The system supports many different types of hooks; each type provides access to a different aspect of its message-handling mechanism. For example, an application can use the WH_MOUSE Hook to monitor the message traffic for mouse messages.

    系统支持很多不同种类的钩子,每种类型提供对消息处理机制里的某一不同方面的访问。例如,应用程序可以使用WH_MOUSE Hook监视鼠标消息的传递。

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    The system maintains a separate hook chain for each type of hook. A hook chain is a list of pointers to special, application-defined callback functions called hook procedures. When a message occurs that is associated with a particular type of hook, the system passes the message to each hook procedure referenced in the hook chain, one after the other. The action a hook procedure can take depends on the type of hook involved. The hook procedures for some types of hooks can only monitor messages; others can modify messages or stop their progress though the chain, preventing them from reaching the next hook procedure or the destination window.

    系统为每类钩子维护着一个独立的钩子链表。钩子链表是一个指针的列表,其中的指针指向特定的、应用程序定义的回调函数,该函数被叫做钩子子程(hook procedure)。当与某种特定类型的钩子相关联(钩住)的消息发生时,系统将消息一个接一个地传递给钩子链中的每一个钩子子程(hook procedure),钩子子程能够采取的动作取决于涉及的钩子的类型。某些类型的钩子子程仅仅能监视消息;另外一些就能够修改消息或者终止消息在钩子链表中的前进,这样就阻止了消息到达下一个钩子子程或者目标窗体。

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    这里有几个概念上的翻译,我参考的网上大家普遍的叫法。主要有:

    Hook Chain : 钩子链表

    hook procedures : 钩子子程(即得到消息后进行处理的程序段)

    下一个话题是钩子子程,是比较重要的内容,又比较长,放在下一篇单独讲述。

  • 相关阅读:
    QThread的用法:开启与退出
    QThread必须要了解的几个函数
    Ubuntu16.04LTS +Qt+boost1.66编译错误:consuming_buffers.hpp: parse error in template argument list
    安装gcc-6系列与安装boost (Ubuntu16.04LTS)
    Qt 的线程与事件循环
    Linux 平台和 Windows平台下 Unicode与UTF-8互转
    [spark] spark 特性、简介、下载
    [hadoop读书笔记] 第十五章 sqoop1.4.6小实验
    [hadoop读书笔记] 第十五章 sqoop1.4.6小实验
    [hadoop读书笔记] 第十五章 sqoop1.4.6小实验
  • 原文地址:https://www.cnblogs.com/DuanLaoYe/p/5501006.html
Copyright © 2011-2022 走看看