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.

+1


source to share


2 answers


The above answers are completely wrong and don't even know what PAS is. This will be answered hundreds of times over 20 years on Usenet. You must use IPC of course (RPM)



request news: //comp.os.ms-windows.programmer.win32 for the code.

+2


source


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).

+4


source







All Articles