Win32: subclassing Windows programs

Thierry Reignier thierry.reignier at gmail.com
Mon Apr 11 18:49:53 UTC 2005


Hi,

In Windows terms subclassing is: the process of hooking into a
window's message handler and trapping selected messages within your
own message hanlder. In short sniffing what another program one starts
is doing.

It is done by calling SetWindowLongPtr in user32.dll.
like SetWindowLongPtr (handle, GWL_WNDPROC, AddressOf WindowProc)
(replaces setwindowlong)

Has someone ever wanted this or already done it? (I found old
reference to it back in Feb 2001 but not for GWL_WNDPROC)

I looked at ExternalWindowsOSProcess in OSProcess. It creates a
process to run an external program and signals when it ends via the
update: method. Naively I though it would also catch/pass other events
of my child process but not (of course). Second though was to go for
the SetWindowLongPtr but parameters are more a headack than anything
else.

My C experience dates a bit, where could I find / implement the
AddressOf? Is ExternalAddress the class I should use? But then what
would be the windowProc address in my squeak image?

I found this post from June 2000
http://lists.squeakfoundation.org/pipermail/squeak-dev/2000-June/003380.html
but are there any solutinout there by now?

Is the code for Win32OSProcessPlugin available?

Thanks, Thierry



More information about the Squeak-dev mailing list