比这篇新的文章: Codee#8216
比这篇旧的文章: PageRank算法

Python脚本获取Windows窗口标题,输出到命令行

语言: Python, 标签: 无  2009/11/30发布 9个月前更新 更新记录
作者: 半瓶墨水, 点击654次, 评论(0), 收藏者(0), , 打分:

背景
主题: 字体:
01 #! /usr/bin/env python
02 # -*- coding: utf-8 -*-
03
04 from win32gui import *
05 titles = set()
06 def foo(hwnd,nouse):
07   #去掉下面这句就所有都输出了,但是我不需要那么多
08   if IsWindow(hwnd) and IsWindowEnabled(hwnd) and IsWindowVisible(hwnd):
09     titles.add(GetWindowText(hwnd))
10
11 EnumWindows(foo, 0)
12 lt = [t for t in titles if t]
13 lt.sort()
14 for t in lt:
15   print t


所有评论,共0条:( 我也来说两句)


发表评论

注册登录后再发表评论