Detect when a window comes to front?

c++ / delphi package - dll injection and api hooking
Post Reply
sourcerer
Posts: 9
Joined: Sat Mar 19, 2005 5:33 pm

Detect when a window comes to front?

Post by sourcerer »

Hi,
This may be an incredible stupid question (I'm great at those and always improving that), but is it through hooking possible to detect when a window pops to the foreground? (I'd like to do this in VC but that's a detail).

I know I can poll the foreground window, but I'd specifically wouldn't want to do that.

Anyone?

Thanks,
Kaj
dcsoft
Posts: 380
Joined: Sat Dec 11, 2004 2:11 am
Location: San Francisco Bay Area, CA USA
Contact:

Re: Detect when a window comes to front?

Post by dcsoft »

sourcerer wrote: is it through hooking possible to detect when a window pops to the foreground? (I'd like to do this in VC but that's a detail).
You wouldn't need madCodeHook. Just use SetWindowsHookEx(WH_SHELL, ...) and get the HSHELL_WINDOWACTIVATED message. Or use the WH_CBT and get the HCBT_ACTIVATE message.

-- David
http://www.dcsoft.com
sourcerer
Posts: 9
Joined: Sat Mar 19, 2005 5:33 pm

Thanks :o)

Post by sourcerer »

Thanks David.

It had to be simple. Yet, I find not many things simple once it involves microsoft code.

Again,
Thanks,
Kaj :D
Post Reply