Question

I'm using SetWindowHookEx to load a DLL into another process, but I need to be able to hook into both 32 and 64 bit processes. I guess I need two separate DLLs for that, but can I do it without creating two versions of the "launcher" app? I need to pass a DLL handle to SetWindowsHookEx, but I can't use LoadLibrary to get it.

Was it helpful?

Solution

Use an out of process COM+ object to host the DLL. You can call 64 bit code from 32 bit using this method, so that way most of the launcher code stays the same except for an if statement where you decide to load either a 32 or 64 bit COM+ object. The object can be coded to load the appropriate version of the DLL into the process, one for 64 bit processes and one for 32 bit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top