全局钩子事件取消 [英] Global hook event canceling
问题描述
您好!我想知道如果我有两个不同的应用程序,其中全局挂钩监听相同的事件(让我们说是按键)会发生什么,并且他们都被编程为取消事件然后显示消息?
两者都会显示消息还是只显示一条消息?如果是这样的话为什么?
P.S.我会自己做这个实验,但我不能,因为我的好奇心在杀我,我想在这里问。
Hello! I was wondering what would happen if I had two different applications with global hooks "listening" for the same events(let's say for a key press) and both of them were programmed to cancel the event and then show a message?
Would both of the show the message or only one? If so why?
P.S. I would do this experiment myself but i can't and since my curiosity is killing me I thought to ask here.
推荐答案
来自MSDN [ ^ ]:
From MSDN[^]:
钩子程序可以采取的操作取决于所涉及的钩子类型。某些类型的钩子的钩子程序只能监视消息;其他人可以修改消息或通过链停止他们的进度,防止他们到达下一个钩子程序或目标窗口。
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 through the chain, preventing them from reaching the next hook procedure or the destination window.
因此,我想(就像你,我还没有测试过)只有拦截事件的第一个钩子程序会显示信息。
Hence, I suppose (like you, I have not tested it) that only the first hook procedure intercepting the event would show the message.
这篇关于全局钩子事件取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!