Reading text labels from a Win32 window

Thomas Heller theller at ctypes.org
Wed Nov 29 03:05:29 EST 2006


jUrner at arcor.de schrieb:
> geskerrett at hotmail.com schrieb:
> 
>> Does anyone know of a way to read text labels from a Win32 application.
>> I am familiar with using pywin32 and the SendMessage function to
>> capture text from Buttons,text boxex, comboboxes, etc, however, the
>> text I am would like to capture doesn't appear to be in a control.
> 
> 
> This article tells the whole story
> 
> "The secret life of GetWindowText"
> http://blogs.msdn.com/oldnewthing/archive/2003/08/21/54675.aspx

Appended is a script that is a fairly straight-forward conversion of the
code in the above article to Python.  Needs ctypes and comtypes.

Python 2.5 already includes ctypes; comtypes can be installed
with 'easy_install comtypes'.

Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: text_at_cursor.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20061129/290b28d7/attachment.ksh>


More information about the Python-list mailing list