SetWindowsHookEx() 设置的钩子以什么顺序接收消息?
In which order do the hooks set by SetWindowsHookEx() receive messages?
如果应用程序 A 调用 SetWindowsHookEx() 插入低级鼠标钩子(WH_MOUSE_LL),应用程序 B 之后也这样做,哪个会先收到消息?
行为记录在 Hooks Overview:
The SetWindowsHookEx function always installs a hook procedure at the beginning of a hook chain. When an event occurs that is monitored by a particular type of hook, the system calls the procedure at the beginning of the hook chain associated with the hook. Each hook procedure in the chain determines whether to pass the event to the next procedure. A hook procedure passes an event to the next procedure by calling the CallNextHookEx function.
在您的示例中,挂钩 B 将首先收到消息,因为它是最近安装的。
如果应用程序 A 调用 SetWindowsHookEx() 插入低级鼠标钩子(WH_MOUSE_LL),应用程序 B 之后也这样做,哪个会先收到消息?
行为记录在 Hooks Overview:
The SetWindowsHookEx function always installs a hook procedure at the beginning of a hook chain. When an event occurs that is monitored by a particular type of hook, the system calls the procedure at the beginning of the hook chain associated with the hook. Each hook procedure in the chain determines whether to pass the event to the next procedure. A hook procedure passes an event to the next procedure by calling the CallNextHookEx function.
在您的示例中,挂钩 B 将首先收到消息,因为它是最近安装的。