不建议在同一进程中同时导入 System.Windows.Automation,System.Windows.Automation.3。
如果先导入了 System.Windows.Automation.3 则导入 System.Windows.Automation 时忽略不作任何操作。
说明
.NET System.Windows.Automation 组件。
System.Windows.Automation.3 扩展库可导入兼容的库。
用法相同且扩展了部分接口。
相关文档
System.Windows.Automation.And({
ClassName = "Notepad",
ControlType = "Window";
})
查找节点。
凡是使用此函数返回的节点都会提供一个 Find 函数用于查找子节点。
其他函数返回的节点没有 Find 方法。
此函数只有一个参数时作用与 FindByAnd 函数相同。
表中的任何一个表参数都是 and 条件,而多个参数之间是 or 条件。
如果参数表中单个键值对的值部分是数组,则该键值对为一个 or 条件。
表中的名字应当是 UIA 对象的属性名,首字母要大写,
常见的属性例如 AutomationId,Name,ControlType 等,详见 UIA 文档。
ControlType 属性可用的值为 System.Windows.Automation.ControlType 的成员,
常见的如 "Button", "Text",也可以写数值。
例如 inspect 里 ControlType 显示 UIA_TextControlTypeId (0xC364)
那么在这里要么写 "Text",要么就写 0xC364。
此函数只有一个参数时作用与 FindByAnd 函数相同。
表中的任何一个表参数都是 and 条件,而多个参数之间是 or 条件。
表中的名字应当是 UIA 对象的属性名,首字母要大写,
常见的属性例如 AutomationId,Name,ControlType 等,详见 UIA 文档。
ControlType 属性可用的值为 System.Windows.Automation.ControlType 的成员,
常见的如 "Button", "Text",也可以写数值。
例如 inspect 里 ControlType 显示 UIA_TextControlTypeId (0xC364)
那么在这里要么写 "Text",要么就写 0xC364。
System.Windows.Automation.FindByAnd({
ClassName = "Notepad",
ControlType = "Window";
})
System.Windows.Automation.FindByOr({
ClassName = {"RichEditD2DPT","RICHEDIT50W","Edit" }
})
获取当前输入光标位置,
返回表示屏幕位置的 ::RECT 结构体,hwnd 字段指定句柄。
可选用参数 @1 指定输入焦点所在窗口句柄。
此函数用于 winex.caret ,
由 System.Windows.Automation.3 库实现。
System.Windows.Automation.Not({
ClassName = "Notepad",
ControlType = "Window";
})
System.Windows.Automation.Or({
ClassName = {"RichEditD2DPT","RICHEDIT50W","Edit" }
})
自 @hwnd 参数指定句柄的窗口获取 AutomationElement 对象
获取当前拥有输入焦点的 AutomationElement 对象