Hi.
Another quick question:
I need to catch several messages from windows that do not belong to my app. i tried to do this with subclassing but didn't work. will i have to use windows hooks? or is there another possibility? a small program (Spy++) that comes with vc++ does not seem to use any windows hooks. at least my debugger did never break at SetWindowsHookEx. any suggestions?


thanks in advance.
Posted on 2001-09-05 06:36:51 by darester
This is a just an idea: I'm not sure it will works but...

You can use the 'SetWindowLong' procedure with GWL_WNDPROC to set a new window procedure to one of yours. Your window procedure will receive every message (this is what you want) of the application you are interested in.
Remember to call the original Window Procedure (got with 'GetWindowLong') passing it all the parameters you have received.

You can use 'FindWindow' to get the handle of the window.

Hope it's useful.

Sincerely,

Daniel

P.S.
Good Luck ;)
Posted on 2001-09-05 07:42:55 by dguzz
dguzz: you can't do that because your code address is only valid and only exists in it's own process space..
darester: The only thing I can think of are hooks...

Thomas
Posted on 2001-09-05 07:57:35 by Thomas
Ok... sorry...

It seemed TOO SIMPLE really... and I didn't think about address space...

Sorry again, :(

Daniel
Posted on 2001-09-05 08:36:19 by dguzz
your hook proc must be localized in a dll since your dll will be copies in all processes with hooked windows (this cant be done with a exe).

japheth
Posted on 2001-09-05 09:11:38 by japheth
so, does it have to be a hook or not? can't just the window procedure be in the dll? please try to explain more in detail.....

thanks in advance.

bye
Posted on 2001-09-06 09:20:38 by NOP-erator