On Windows, how can I list and get text from other controls?
In particular - I have a window handle of another running application. This app contains a control TListControl.UnicodeClass
somewhere (I know this from Winspector). How do I, using the Windows API and this window handle, loop through all the items in this list control and get the text from all the items?
You can assume that the language is C / C ++, although I do use win32all for python. Links to the relevant API calls would be great.
source to share
You want EnumWindows and EnumChildWindows to enumerate. See here for examples and usage / warning information.
For window text, once you have a matching HWND, you want GetWindowText in general and API-specific control if the text is stored elsewhere (ex: list control). For a specific control, you will need to know the specific API, and it may not be available even though the Windows API calls (for example, controls with owner drawing elements may store their text in an application that is not available to Windows).
source to share