Question

I'm currently using SetWindowsHookEx to inject my DLL into another process, however it does not get loaded right away. I noticed that if I manually click the window, it will get loaded then, so I'm guessing it is waiting for some type of message to get the activation rolling? I'm currently getting it activated with a

SetForegroundWindow(otherAppHwnd);
SetForegroundWindow(myAppHwnd);

But this seems like a hack, and doesn't always work (i.e. the otherAppHwnd is minimized to the taskbar.

Any pointers would be great!

Edit: It is a CBT Hook

Was it helpful?

Solution 2

It seems that this is not possible.

So instead of forcing my way around this, I decided to just roll with it and make my design be able to handle this.

OTHER TIPS

I've successfully used this:

SendMessage(otherAppHwnd, WM_NULL, 0, 0);

to achieve what you want, but only with lower-level hooks like WH_GETMESSAGE, never a CBT hook. It might work. 8-)

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