import uiautomation as auto def scan_windows(): print("[*] 正在扫描当前桌面的所有顶层窗口...") root = auto.GetRootControl() found_wx = False for window in root.GetChildren(): name = window.Name class_name = window.ClassName # 重点高亮带有企微/微信特征的窗口 if "企业微信" in name or "微信" in name or "wechat" in class_name.lower() or "wx" in class_name.lower(): print(f"[!] 疑似目标 -> 窗口名称: '{name}', ClassName: '{class_name}'") found_wx = True if not found_wx: print("[-] 未在顶层窗口中发现企业微信的踪迹。") print("\n可能的原因:") print("1. 企业微信完全缩小到了系统托盘(右下角),没有实体窗口在桌面上。") print("2. 权限不足:企业微信可能以管理员权限运行,导致当前终端没有权限捕获它。") if __name__ == "__main__": scan_windows()