all groups > dotnet interop > july 2004 >
You're in the

dotnet interop

group:

subclass a window


subclass a window Steven
7/30/2004 7:30:49 PM
dotnet interop:
Hi all,
I am trying subclass a window that belongs to another process and
catch the WM_CLOSE message and update my process' user interface. Does
anyone have any code, pointers to code, or ideas that will accomplish this
end?

Thanks,
Steve

Re: subclass a window Mattias Sjögren
7/31/2004 6:16:49 PM
Steven,

[quoted text, click to view]

You can't do that with SetWindowLong. Catching messages in other
processes either requires code injection (something like
CreateRemoteThread) or a global message hook. Both are ugly and messy
to implement.


[quoted text, click to view]

Personally I'd go for a polling solution rather than rely on
notifications. Perhaps periodically call EnumWinows or
EnumProcesses/Process32First to enumerate windows or processes. This
has the additional advantage of working even if the foreign app
crashes and no WM_CLOSE message is sent.



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Re: subclass a window Steven
8/2/2004 1:31:44 PM
Thanks for the input.

[quoted text, click to view]

AddThis Social Bookmark Button