32 位键盘挂钩意外在 64 位应用程序中工作,但挂起 Outlook [英] 32-bit Keyboard Hook unexpectedly works in 64-bit apps, but is hanging Outlook

查看:27
本文介绍了32 位键盘挂钩意外在 64 位应用程序中工作,但挂起 Outlook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经阅读了很多关于这个的文章,但图片变得更模糊了.我有一个 32 位应用程序,它安装了一个 KeyboardHook 来等待全局热键并唤醒.在 Win 7 x64 版上运行它我注意到按下热键时它会挂起 Outlook x64 版.

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.

所以我做了一些研究,看起来 32 位键盘钩子甚至不应该在 64 位应用程序中工作.是时候进行更多测试了...

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...

它们的热键在 64 位记事本、写字板和便签中运行良好.我确认这些是 64 位应用程序,因为它们在任务管理器中旁边没有*32".不会挂起应用程序,它会做它应该做的事情.但是等等……一个 32 位的钩子 dll 不能加载到 64 位的应用程序中,对吧?

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?

查看进程资源管理器显示钩子 dll 甚至没有加载到记事本进程中!(如果我从 WOW64 目录运行 32 位 notepad.exe,我可以看到加载到进程中的 dll,所以我知道我正在使用正确的工具).

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).

因此,Outlook 挂起问题可能相关,也可能无关,但为什么挂钩甚至在 64 位记事本中都能正常工作?

So the Outlook hanging issue might or might not be related, but why is the hook even working at all in 64-bit notepad?

推荐答案

我有一个 32 位应用程序,它安装了一个 KeyboardHook 以等待全局热键并唤醒.

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 位应用程序中工作,但挂起 Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆