如何在 c# 中包含 AutomationElement?我需要补充什么? [英] How can I include AutomationElement in c# ? What do I have to add?

查看:98
本文介绍了如何在 c# 中包含 AutomationElement?我需要补充什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法初始化 AutomationElement.

I can't initialize the AutomationElement.

AutomationElement element = AutomationElement.FromHandle(process.MainWindowHandle);

它突出显示 AutomationElement 它说的错误是 http://i.stack.imgur.com/wNCvq.png

It highlights the AutomationElement The error it says is http://i.stack.imgur.com/wNCvq.png

推荐答案

需要添加相关程序集并添加 using 语句才能使用该类.在这种情况下,您需要 UIAutomationClient.dll 程序集和 using 语句:using System.Windows.Automation.AutomationElement在您的类的顶部.

You need to add the relevant assembly and add a using statement to use the class. In this case you need the UIAutomationClient.dll assembly and the using statement: using System.Windows.Automation.AutomationElementat the top of your class.

有关详细信息,请访问 MSDN 页面:https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement%28v=vs.110%29.aspx

For more info, visit the MSDN page: https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement%28v=vs.110%29.aspx

这篇关于如何在 c# 中包含 AutomationElement?我需要补充什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆