'Using the “Selection Pattern” of UIAutomation to get the current selections
'object1 is an “Array” of “AutomationElement”, refer to MSDN for class ‘ “SelectionPattern”
Set object1 = WpfWindow("YourWindow").WpfTreeView("MyTreeView").AutomationPattern_("Selection").Current.GetSelection()
'Using the method “GetValue” of “Array” , refer to MSDN help for “Array” class
'object2 is an object of “AutomationElement”
Set object2 = object1.GetValue(0)
'Using the “Current” property of “AutomationElement” to get object of ‘“AutomationElementInformation” and his property “BoundingRectangle”
' object3 is an object of “Rect” , refter to MSDN
Set object3 = object2.Current.BoundingRectangle
'class “Rect” has the property x, and y
x = object3.x
y = object3.y
'Doubleclick
WpfWindow("YourWindow").WpfTreeView("MyTreeView").DblClick x,y作者: walker1020 时间: 2007-12-5 22:20
学习一下Automation Elements 技术,谢谢muquanyifan!