.NET 和 Delphi 中的多个键盘挂钩
我有一个包含 .NET 和 Delphi 组件的应用程序 我在两个组件中注册了键盘钩子(使用 SetWindowsHookEx)。 我首先在.NET 中注册,然后在Delphi 中注册。
问题是,Delphi 中的钩子委托在 .NET 中的钩子委托之前被调用。
根据 MSDN,钩子链只是一个列表,据我了解,应该根据注册顺序。
有人知道这里发生了什么事吗? 提前致谢!
I have an application with both .NET and Delphi components
I register to a keyboard hook (with SetWindowsHookEx) in both components.
I first register in .NET, and later in Delphi.
The problem is, the hook delegate in Delphi is called before the hook delegate in .NET.
According to MSDN, the hook chain is just a list, and as I understand the delegates should be called according to the order of registration.
Anyone has an idea what is going on here?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你误会了。 MSDN 中的钩子概述是这样描述的(强调是添加的):
因此,如果您的 Delphi 钩子最后安装并且最先调用,这正是预期的行为。根本没有什么“发生”。
You've misunderstood. The hook overview in MSDN describes it like this (emphasis added):
Therefore, it's precisely the expected behavior if your Delphi hook is installed last and is called first. There's nothing "going on" at all.
钩子列表不是列表,而是链。新安装的钩子保留对前一个钩子的引用。这意味着后来安装的钩子总是在先安装的钩子之前执行。
The hook list is not a list, but a chain. Newly installed hook keeps the reference to the previous one. This means that the hook, installed later, is always executed before the hook installed earlier.