I have been working on filtering out windows out of EnumWindows from only including windows that are minimized or open to a list.
Code
def winEnumHandler(hwnd, ctx):
title = win32gui.GetWindowText(hwnd)
# Append HWND to list
if win32gui.IsWindowVisible(hwnd) and title != '':
app = ApplicationWindow(hwnd, title)
applications.append(app)
def scanApplication():
applications.clear()
win32gui.EnumWindows(winEnumHandler, None)
return applications
Expected/Actual
The problem with this code is that it does not correctly filter out some windows that are found through the EnumWindows
For example currently I have: Chrome ,IDE, and Discord open on my computer and only expect these to be in the applications list. However, I not only get those windows but background tasks such as: Calculator, Mail, Geforce Overlay, etc... These Background tasks are active but there is no window on the desktop nor are any of these minimzed. How would I be able to filter out background tasks out of EnumWindows
? Thanks for reading!