Luthgers,
Fri Aug 15 07:02:19 CDT 2008
Hi Alex,
getting the window title of a window created in a different process isnt
that easy. I dont know if it is possible within net framework (via interop
or something else) -- i dont think so, but it should be possible in C++. The
main problem would be to communicate between the different processes that
have created the top level windows (and there childs). To retrieve the title
of a window, you normally send a WM_GETTEXT message to the window. This
message contains a memory adress, where the title text should be stored.
Well, each process has its own adress range and is protected from access of
a different process. So if you send the message to another process, the
process is not able to write to your memory and you will never get the text.
To get arround this, you need to implement a DLL that create a shared memory
block. The shared memory block can then be accessed by multiple processes.
http://msdn.microsoft.com/en-us/library/ms686958(VS.85).aspx
The next step you need to do, is to create a system wide hook to load your
dll into all existing processes. (Spy++ works this way.... and you always
need administrative permissions for that). Then you can send the WM_GETTEXT
message with a shared memory adress to that process and the process is able
to write to this memory adress.
http://msdn.microsoft.com/en-us/library/ms632589(VS.85).aspx
And this could become a very difficult task...
-J-