解决uiautomation.WindowControl使用CaptureToImage无反应 博主在使用uiautomation截图功能时发现程序运行正常,打断点也没有用,通过对比其他文章代码后发现,在uiautomation.WindowControl里面增加searchDepth即可成功截图 猜测是因为截图功能需要搜索定位当前窗口的缘故 uiautomation.WindowControl(searchDepth=1,Name="xxx")