yinkaisheng / Python-UIAutomation-for-Windows

🐍Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...
Apache License 2.0
2.31k stars 462 forks source link

win10系统当缩放比不为1时, 某些程序获取菜单的矩形值是错误的 #241

Open Happy-lukelly opened 1 year ago

Happy-lukelly commented 1 year ago

您好:

yinkaisheng commented 1 year ago

Python代码里已经处理了DPI, 用automation.py应该是正常的,提供了SetProcessDpiAwareness和SetThreadDpiAwarenessContext函数。 inspect.exe是微软Windows SDK里的工具,无法修改。

yinkaisheng commented 1 year ago

这个是系统bug,32位的程序获取notepad.exe在dpi不是100%时获得的矩形不准,用64位python获取是准的。 参考demos/automation_notepad.py 之前给微软反馈了: https://github.com/microsoft/accessibility-insights-windows/issues/1122

Happy-lukelly commented 1 year ago

@yinkaisheng 嗯嗯,谢谢大佬解释了,目前遇见的也是很奇怪的现象,使用automation.py在dpi不为1的电脑上有的能正确获取到矩形有的不行