zoukankan      html  css  js  c++  java
  • 利用python+win32获取windows中任务中所有的窗口标题

    # #!/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)
  • 相关阅读:
    Linux
    Python
    Linux
    Python
    爬虫
    WEB
    法正(13):密谋
    法正(12):张松
    法正(11):入川
    法正(10):袍哥
  • 原文地址:https://www.cnblogs.com/yunlongaimeng/p/14886727.html
Copyright © 2011-2022 走看看