1

我有一个无法最小化的窗口。
我必须阻止用户在 gui 自动化时访问它。
如何用pywinauto处理这类问题?

它适用于 autoit 和 WinSetTrans() 函数。
pywinauto 模块中有类似的东西吗?

4

1 回答 1

1

pywinauto中没有这种方法,但是很容易实现。感谢您的功能请求!

到目前为止,您可以解决它:

import win32gui, win32api, win32con

hwnd = app.dlg.ctrl.handle
ex_style = app.dlg.ctrl.ExStyle()
win32gui.SetWindowLong (hwnd, win32con.GWL_EXSTYLE, ex_style | win32con.WS_EX_LAYERED )
win32gui.SetLayeredWindowAttributes(hwnd, win32api.RGB(0,0,0), 180, win32con.LWA_ALPHA)

PS它很快就改编自已知答案(我还没有检查过)。我们将SetTransparent在 pywinauto 0.5.3 中包含类似方法(本周计划)。

于 2015-09-24T08:53:18.547 回答