[python-win32] getting the contents of a Control in a window

Daniel F nanotube at gmail.com
Tue Apr 12 21:07:26 CEST 2005

> I am trying to get the contents of a control in a window, say a TextArea
> control or a List or a button etc.
> I can programmatically get the window its in and then the controls handle by
> enumming the child windows of that window.
> I cannot get the contents of that control.
> I'm a tester and I need to be able to confirm the contents programmatically
> before moving on with the test.
> I know there are 3rd party applications out there that can do it so it must
> be possible but I cannot use these it has to be python (unless there is a
> Python one that I have missed?).
> I have dug through the python forums and not found anything so far.
> I thought that since this was all about win32 it would be the best place for
> an answer or example.

have you tried win32gui.GetWindowText(hwnd) ?

you may note that the msdn api reference specifies 3 arguments for
this function, but pywin32 takes only one, the hwnd. dont know why,
but it certainly makes the function much easier to use...


More information about the Python-win32 mailing list