[python-win32] build list of all tasks like Alt-TAB box
Tim Roberts
timr at probo.com
Wed Aug 10 20:45:50 CEST 2005
On Tue, 09 Aug 2005 09:17:24 -0400, Benjamin Rutt <rutt at bmi.osu.edu> wrote:
>Benjamin Rutt <rutt at bmi.osu.edu> writes:
>
>
So, you're from that OTHER OSU? (From an Oregon State University
alumnus...)
>-----------------------------------------------------------------------------
>from win32gui import *
>from win32con import *
>
>gwl_style = GWL_STYLE
>
>def windowEnumerationHandler(hwnd, resultList):
> '''Pass to win32gui.EnumWindows() to generate list of window handle, window\
> text tuples.'''
> if IsWindowVisible(hwnd):
> val = GetWindowLong(hwnd, gwl_style)
> if val & WS_VISIBLE:
> if not val & WS_CHILD:
> if not val & WS_EX_TOOLWINDOW:
> if val & WS_EX_CONTROLPARENT:
> val = GetWindowLong(hwnd, gwl_style)
> txt = GetWindowText(hwnd)
> resultList.append((hwnd, txt))
>
>windows = []
>EnumChildWindows(GetDesktopWindow(), windowEnumerationHandler, windows)
>for w in windows:
> print "%10s %s" % (w[0], w[1])
>-----------------------------------------------------------------------------
>
>Does anyone happen to know why if the window handle is not an
>WS_EX_TOOLWINDOW and is an WS_EX_CONTROLPARENT, then it is one of the
>taskbar programs? Thanks,
>
>
Google is your friend. WS_EX_TOOLWINDOW is used to create floating
toolbars, which can exist outside of the parent app. You don't want
those showing up as main windows. WS_EX_CONTROLPARENT essentially says
"this window contains other controls". Getting rid of this probably
gets rid of text-only windows, like tooltips and balloon help.
The "spyxx.exe" tool can be used to poke around the window list to find
these things.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list