32位键盘钩子在64位应用程序意外地工作,但挂展望 [英] 32-bit Keyboard Hook unexpectedly works in 64-bit apps, but is hanging Outlook
问题描述
一直在阅读了很多关于这一个,画面只是变得泥泞。我有一个32位的应用程序,安装一个的KeyboardHook等待全局热键和唤醒。在Win 7 x64版本上运行它,我发现它挂展望x64版本的时候热键是pressed。
所以,我做了一些研究,它看起来像32位键盘钩子甚至不应该在64位应用程序的工作。时间更多的测试...
这些热键工作正常,在64位的记事本,写字板,和便签。我证实这些是64位应用程序,因为它们不具有* 32旁边在任务管理器。不挂的应用程序,它做什么,它应该。但等待...... 32位钩子DLL不能加载到64位应用程序,对吧?
一看进程资源管理器显示了钩子DLL甚至没有加载到记事本程序! (如果我运行WOW64目录中的32位的notepad.exe,我可以看到加载到进程的DLL,所以我知道我使用的工具右)。
所以,展望挂的问题可能会或可能不会进行相关的,但为什么被钩连工作都在64位的记事本?
我有一个32位的应用程序,安装一个的KeyboardHook等待全局热键和唤醒。
如果这是你的终极目标,那么它的简单和更小的对系统的影响只是使用的 RegisterHotKey 。
Have been reading a lot about this one and the picture just gets muddier. I have a 32-bit app that installs a KeyboardHook to wait for a global hotkey and wake up. Running it on Win 7 x64 edition I notice it hangs Outlook x64 edition when the hotkey is pressed.
So I did some research and it looks like 32-bit keyboard hooks aren't even supposed to work in 64 bit apps. Time for more testing...
They hotkey works fine in 64-bit notepad, wordpad, and sticky notes. I verified that these are 64-bit apps since they don't have "*32" next to them in Task Manager. Doesn't hang the app and it does what it's supposed to. But wait... a 32-bit hook dll can't be loaded into a 64-bit app, right?
A look at Process Explorer shows the hook dll isn't even loaded into the notepad process! (If I run the 32-bit notepad.exe from WOW64 directory, I can see the dll loaded into the process, so I know I'm using the tools right).
So the Outlook hanging issue might or might not be related, but why is the hook even working at all in 64-bit notepad?
I have a 32-bit app that installs a KeyboardHook to wait for a global hotkey and wake up.
If that's your ultimate goal, then it's simpler and less of an impact on the system to just use RegisterHotKey.
这篇关于32位键盘钩子在64位应用程序意外地工作,但挂展望的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!