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

Tim Roberts timr at probo.com
Wed Apr 13 01:52:00 CEST 2005


On Tue, 12 Apr 2005 15:07:26 -0400, Daniel F <nanotube at gmail.com> wrote:

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

Because those are outputs of GetWindowText.  For any API that returns a 
string, the Windows API will have you pass in a buffer and a buffer 
size.  In Python, strings can vary in length, so there is no need to 
send a pre-allocated string.  The Python Win32 wrapper conveniently 
creates the buffer for you, and passes the resulting string as a return 
from the function.

-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list