[python-win32] how to get the statusbar text of a window?
Tim Roberts
timr at probo.com
Fri May 29 20:06:59 CEST 2009
Alec Bennett wrote:
> I'm trying to read the statusbar text of a window under Python. I'm guessing win32gui is the way to go, and thought the GetWindowText function was promising, but alas I can't get it to return anything other than the text of the titlebar.
>
> Can anyone think of any clever ways to do this?
>
Niki is correct. The status bar is a child window. However, the answer
to your question depends on which application you want to scrape. Many
apps use the standard "msctls_statusbar32" control to implement status
bars. If yours does, you can enumerate the child windows until you find
a window of class "msctls_statusbar32", then use the status bar APIs to
get the contents of its panels.
However, even that isn't foolproof. Thunderbird and Firefox, as an
example, have implemented their own custom window classes for all of
their controls. They don't respond to normal window messages from the
outside. The Office applications don't use separate windows for their
controls; their windows are just one big empty canvas, where everything
is painted internally.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list