I would like, if for no other reason that an academic exercise, to be able to read text written to a form on a Windows Application. The program appears to be written in non-.NET, but in .NET terms, I think you would describe the program as having a Form with a Label and I would like to read the text from that label.
I believe I can see that text being written to the screen with the User32!TextOut (and in other areas User32!DrawString) function. However, it would be nice if I didn’t have to hook that function to get the information I’m looking for, but instead if I could just read it from the form directly.
So, given a handle to a Window, is it possible to read the text that has been written to that window with functions like TextOut and DrawString using some similar API or other clever means?
Or am I going about this the wrong way? Should I just hook the function and look for the text in every call and pray?
Thanks!
If the text is stored in the standard way on the control you can use SendMessage
If the control was written with security in mind, the text is almost certainly not stored in a format that can be queried through the Windows API.
I used to use a program called Snadboy Revelation to grab forgotten passwords out of programs (that were just displaying as *****). Revelation uses the same technique. However, most modern software hides the text of password and similar fields so this is not of as much use these days.
UPDATE:
Found source code for a Windows Spy app.