# #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021-06-15 18:06
# @Author : BruceLong
# @FileName: get_win_title.py
# @Email   : 18656170559@163.com
# @Software: PyCharm
# @Blog :http://www.cnblogs.com/yunlongaimeng/
from win32gui import *

titles = set()


def foo(hwnd, nouse):
    # 去掉下面这句就所有都输出了,但是我不需要那么多
    if IsWindow(hwnd) and IsWindowEnabled(hwnd) and IsWindowVisible(hwnd):
        titles.add(GetWindowText(hwnd))


EnumWindows(foo, 0)
lt = [t for t in titles if t]
lt.sort()
for t in lt:
    print(t)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-17
  • 2022-02-06
  • 2021-07-10
  • 2022-01-18
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案