List all opened windows on Windows

You can use the function get_all_windows to get a dictonnary containing the titles of the opened windows as keys and the handles of those windows as values

import win32gui


def get_all_windows():
    """
    Returns dict with window desc and hwnd,
    """

    def _MyCallback( hwnd, extra ):
        hwnds, classes = extra
        hwnds.append(hwnd)
        classes[win32gui.GetWindowText(hwnd)] = hwnd
    windows = []
    classes = {}
    win32gui.EnumWindows(_MyCallback, (windows, classes))
    return classes
get_all_windows()
{'': 3802422,
 'Forcepad driver tray window': 65676,
 'Jauge de batterie': 131542,
 'Network Flyout': 131650,
 'Dashlane': 5570658,
 'Wox': 131770,
 'JupyterLab - Brave': 66990,
 'python': 4261478,
 'Visual Studio Code - Insiders': 329780,
 'Code - Insiders': 526478,
 'Documents': 526010,
 'Windows PowerShell': 198580,
 'Progression': 394934,
 'Microsoft Edge': 131586,
 'Microsoft Store': 197328,
 'QTrayIconMessageWindow': 327816,
 'Hidden Window': 459506,
 '.NET-BroadcastEventWindow.4.0.0.0.3e2c690.0': 131824,
 'SystemResourceNotifyWindow': 197346,
 'MediaContextNotificationWindow': 197344,
 'Resilio Sync 2.6.3': 262934,

}

print("List of all opened windows : ")
for key, value in get_all_windows().items():
    if key != "": 
        print("\t* " + key.split("\n")[0])
List of all opened windows : 
    * Forcepad driver tray window
    * Jauge de batterie
    * Network Flyout
    * Dashlane
    * Wox
    * JupyterLab - Brave
    * python
    * Visual Studio Code - Insiders
    * Code - Insiders
    * Documents
    * Windows PowerShell
    * Progression
    * Microsoft Edge
    * Microsoft Store
    * QTrayIconMessageWindow
    * Hidden Window
    * .NET-BroadcastEventWindow.4.0.0.0.3e2c690.0
    * SystemResourceNotifyWindow
    * MediaContextNotificationWindow
    * Resilio Sync 2.6.3