Get a window text by handle

1.5k views Asked by At

I use UI Spy and Spy++ to view windows text of some windows, but none offers a result. As people said, some windows are built up and executed by some components, say they are embedded inside those components. Except the two tools to view the window handles, text, could you introduce me other tools or ways to get a window text or handle without using hooks ?

Edit: I also use Spy Object to retrieve windows objects information and search from ancestors till I can meet the right object but this tool to the particular windows I am watching is incapable to do the job because it also reports incorrect parents positions in ancestor hierarchy, I try out the MAAS and UI-Automation without luck, Thank you for you help.

Edit3: I don't like their windows'ideas of internal designs (I mean only they-designers- know how to untie the knots)

2

There are 2 answers

0
Ben Voigt On

Usually the Accessibility APIs are used, the ones used for text-to-speech screen readers for blind users. In your question you mentioned MAAS, did you mean MSAA (Microsoft Active Accessibility)? If not, that's where I'd look next.

0
Rosmarine Popcorn On

http://white.codeplex.com/ is a great framework which does such things.

White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages. Tests/automation programs using White can be written with whatever .NET language, IDE and tools you are already using. White provides a consistent object-oriented API, hiding the complexity of Microsoft's UIAutomation library (on which White is based) and windows messages. Only stable versions of White are released, so all releases are production-ready.