win32gui.EnumWindows
python2
import win32gui, win32con, win32api
import time, math, random
def _MyCallback( hwnd, extra ):
windows = extra
temp=[]
temp.append(hex(hwnd))
temp.append(win32gui.GetClassName(hwnd))
temp.append(win32gui.GetWindowText(hwnd))
windows[hwnd] = temp
def TestEnumWindows():
windows = {}
win32gui.EnumWindows(_MyCallback, windows)
print "Enumerated a total of windows with %d classes" ,(len(windows))
print '------------------------------'
#print classes
print '-------------------------------'
for item in windows :
print windows[item]
print "Enumerating all windows..."
h=win32gui.FindWindow(None,'\xba\xec\xce\xe5')
print hex(h)
#TestEnumWindows()
print "All tests done!"
python3
import win32gui
def _MyCallback(hwnd, extra):
windows = extra
temp = []
temp.append(hex(hwnd))
temp.append(win32gui.GetClassName(hwnd))
temp.append(win32gui.GetWindowText(hwnd))
windows[hwnd] = temp
windows = {}
win32gui.EnumWindows(_MyCallback, windows)
hld=win32gui.FindWindow("TXGuiFoundation",'实时加速工具')
hldb=win32gui.FindWindow("TXGuiFoundation",'实时加速工具2')

import win32gui
def _MyCallback(hwnd, extra):
windows = extra
temp = []
temp.append(hex(hwnd))
temp.append(win32gui.GetClassName(hwnd))
temp.append(win32gui.GetWindowText(hwnd))
windows[hwnd] = temp
windows = {}
win32gui.EnumWindows(_MyCallback, windows)
hld = win32gui.FindWindow("TXGuiFoundation", '实时加速工具')
hldb = win32gui.FindWindow("TXGuiFoundation", '实时加速工具2')
"""
手动确定ClassName-WindowText 窗口组名-单独名
生成临时文件,检索
with open('tmp.txt', 'w', encoding='utf-8') as fo:
for i in windows:
s = '%s%s' % (str(i), str(windows[i]))
fo.write(s)
"""
"""
8064026['0x7b0c1a', 'BS2CHINAUI', '']
201748['0x31414', 'BS2CHINAUI', 'BSCNKEYMAPWND_Android']
660380['0xa139c', 'BS2CHINAUI', '']
529522['0x81472', 'BS2CHINAUI', '']
922564['0xe13c4', 'BS2CHINAUI', 'BlueStacks App Player']
4390956['0x43002c', 'BS2CHINAUI', 'soui tooltip']
988220['0xf143c', 'BS2CHINAUI', 'soui tooltip']
660518['0xa1426', 'BS2CHINAUI', 'soui tooltip']
"""
windowstext = 'BlueStacks App Player'
hld_a,hld_b = win32gui.FindWindow('BS2CHINAUI', 'BSCNKEYMAPWND_Android'),win32gui.FindWindow('BS2CHINAUI', 'BlueStacks App Player')
win32gui.EnumWindows的更多相关文章
- win32gui.EnumWindows my.os.EnumWindows.py
import win32guidef _MyCallback(hwnd, extra): windows = extra temp = [] temp.append(hex(hwnd)) temp.a ...
- python 通过js控制滚动条拉取全文 通过psutil获取pid窗口句柄,通过win32gui使程序窗口前置 通过autopy实现右键菜单和另存为操作
1.参考 利用 Python + Selenium 自动化快速截图 利用 Python + Selenium 实现对页面的指定元素截图(可截长图元素) 使用python获取系统所有进程PID以及进程名 ...
- Python win32gui调用窗口到最前面
Python win32gui调用窗口到最前面 0要写一个轮询几个重要页面的程序,不停的在大屏上进行刷新,通过pywin32模块下的SetForegroundWindow函数调用时,会出现error: ...
- win+python+selenium实现窗口和tab切换
这篇总结主要是关于两方面的需求:其一,在浏览器不同tab标签页之间按时间切换(同事用来不停刷新grid crontol 监控页面):其二,实现开启多个窗口,并将窗口缩放到一定范围,并齐占满整个桌面,按 ...
- Python之窗口操作之find_window,set_foreground等
在自动化测试过程中,常常需要模拟按键的操作,比如像窗口发送一个按键,实现鼠标点击的功能,在上一篇文章中,我和大家讨论了python文件生成为不依赖与python库的exe文件的方式(需要了解的朋友戳这 ...
- Python基础系列讲解-自动控制windows桌面
原链接:https://zhuanlan.zhihu.com/p/73001806 在使用PC时与PC交互的主要途径是看屏幕显示.听声音,点击鼠标和敲键盘等等.在自动化办公的趋势下,繁琐的工作可以让程 ...
- python 前置程序窗口,还原最小化的窗口
python 前置程序窗口,还原最小化的窗口 在网上找了比较久,大多是: win32gui.FindWindow(class_name, window_name) win32gui.SetForegr ...
- python---win32gui、win32con、win32api:winAPI操作
python操作winAPI 窗口操作: import sys from PyQt5.QtWidgets import QApplication, QWidget from lianxi import ...
- RPA项目所遇知识点
1艺赛旗 RPA 技术分享常见问题汇总贴 2python标准库之glob介绍 3RPA基础 4RPA答疑 5python3 遍历windows下 所有句柄及窗口名称 import win32gui h ...
随机推荐
- 深度解析qml引擎---(1)Qml文件加载
"美的事物是永恒的喜悦" --- 济慈 ...
- LeetCode 2. 两数相加(Add Two Numbers)
2. 两数相加 2. Add Two Numbers 题目描述 You are given two non-empty linked lists representing two non-negati ...
- react中使用typescript时,error: Property 'setState' does not exist on type 'Home'
问题描述: 我在react中用typescript时,定义一个Home组件,然后在组件里用setState时会有这样一个报错:(如图)Property 'setState' does not exis ...
- JMeter进行Apache Kafka负载测试
1.卡夫卡负载测试 在这个Apache Kafka教程中,我们将了解如何使用Apache JMeter,如何在Apache Kafka上执行Kafka负载测试.此外,这个Kafka负载测试教程教我们如 ...
- 我的Vue朝圣之路1
1. Vue是什么? 1). 一位华裔前Google工程师开发的前端js库 2). 一个MVVM框架 3). 核心概念 * 数据绑定 ...
- ArcGIS 字段计算器 Python 坑
最近要处理个简单数据,一个字段中为文本类型,包含各种描述.要求是包含平方米的数值提取出来,变成数值,如果包含多个,则把各个值累加起来. 比如 字段值为 “非法占用100平方米” 处理后结果为 100 ...
- Linux进程自保护攻防对抗技术研究(Process Kill Technology && Process Protection Against In Linux)
0. 引言 0x1: Linux系统攻防思想 在linux下进行"进程kill"和"进程保护"的总体思路有以下几个,我们围绕这几个核心思想展开进行研究 . 直接 ...
- harbor helm仓库使用
harbor helm仓库使用 官方文档地址:https://github.com/goharbor/harbor Monocular 从1.0 开始专注于helm 的UI展示,对于部署以及维护已经去 ...
- Spring Boot(二)
Spring MVC流程图 注册流程图: result代码: import java.io.UnsupportedEncodingException; import java.net.URLEncod ...
- JML规格编程系列——OO Unit3分析和总结
本文是BUAA OO课程Unit3在课程讲授.三次作业完成.自测和互测时发现的问题,以及倾听别人的思路分享所引起个人的一些思考的总结性博客.主要包含JML相关梳理.SMT Solver验证.JML单元 ...