32-bit Keyboard Hook unexpectedly works in 64-bit apps, but is hanging Outlook

1.4k Views Asked by At

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?

1

There are 1 best solutions below

0
On

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.