python - Pywin32 - 如何访问“数据句柄”所指的数据
问题描述
我正在尝试收集有关 Windows 应用程序中某些子窗口的信息(使用 C++ 在 Visual Studio 中编写)。我正在使用pywinauto
和pywin32
。
在一个非常小的 python 脚本中,我认为我会使用win32gui.EnumPropsEx
. 返回的信息比我希望的要少,并且返回的项目之一应该是“属性数据的句柄”。有了“句柄”后,如何访问属性数据?
这是代码:
import win32gui
def propfunc(hwnd, prop, x, y):
print("\nProperty for %d is %s\n" %(hwnd, prop))
print("x is %d, and y is %s\n" %(x, y))
return 1
def main():
handleList = (1574574, 722384, 1311872, 1967920, 2295590)
for hwnd in handleList:
print("For hwnd %d:" %hwnd)
win32gui.EnumPropsEx(hwnd, propfunc, None)
print("\n\n\n")
main()
这是我得到的结果的一个(n 编辑)片段:
For hwnd 1574574:
Property for 1574574 is fpTextTip
x is 2621596, and y is None
Property for 1574574 is 43288
x is -1, and y is None
我认为这2621596
是我被告知期望的“属性数据句柄”。我不知道如何检索该属性数据,msdn 也没有帮助。有人愿意告诉我如何从数据句柄获取数据吗?
谢谢!
解决方案
推荐阅读
- python - 尝试定位满足条件的索引时出现索引错误
- excel - Excel - 如何计算表格中特定日期的不同文本的数量?
- java - 如何在 JTable 中使用 JFileChooser 选择文件并在 JTable 中显示数据
- javascript - 仅显示 Treemap HighCharts 的 1 个子节点
- react-native - RN:连续、前后滚动项目
- python - Python中系数的置信区间?
- performance - 火花中的 union() 或 full_outer_join 哪个性能更好?
- android - 安卓信任管理器漏洞
- python - 将字典值从字符串转换为具有浮点类型的单个元素的列表
- sql - 计算一年内每周活跃的不同客户