这种情况下如果获得ID
本帖最后由 satech 于 2009-4-23 09:11 编辑类似这个窗口下的item怎样才能得到他们的ID呢,我需要对它们里的任何一项做鼠标操作?
在线等....对于此问题若大伙有头绪的,也不防说说,谢谢了! 用 window Info看看 那些是什么控件。。。。 info只能读到窗口属性的ID,里面的items就读不到了。。。 先看看是什么类型的控件,不过看楼主的图片,感觉像是自定义的控件,非windows标准控件,如果是自定义的控件那就不好操作了,如果是标准控件的话,au3的函数能操作的话最好,不行的可以用udf操作. 第三方工具,很少见WINDOWS标准控件,实在不行,模拟操作吧,不过,判断起来或操作起来难度黑大。。 我已经找到方法了,谢谢楼主给我post这个问题,也谢谢各位的发言。这次我把我总结的方法贴上来,供大家参考。BTW:写成了Func.SelectListViewItem("", ,"");param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name
Func SelectListViewItem($WinName,$ControlID,$ItemName)
$ItemCount = ControlListView($WinName,"",$ControlID,"GetItemCount")
For $i = 1to $ItemCount Step 1 ;use Loop to find given Item Name
$ItemText = ControlListView($WinName,"",$ControlID,"GetText",$i-1)
if StringCompare($ItemName,$ItemText)=0 then
ControlListView ($WinName, "", $ControlID, "SelectClear") ;Clears the selection of all items.
ControlListView ($WinName, "", $ControlID, "Select",$i-1) ;Selects given item.
Return
EndIf
Next
EndFunc
;---------------------------------------------------------------------------------------------------------------------------
SelectTreeItem("New",25280,"SN8 2800 Series Project") ;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item Name
Func SelectTreeViewItem($WinName,$ControlID,$ItemName)
ControlTreeView ( $WinName, "",$ControlID, "Uncheck") ;Unchecks an item (if the item selected).
ControlTreeView ( $WinName, "",$ControlID, "Select" ,$ItemName) ;Selects given item.
EndFunc
;---------------------------------------------------------------------------------------------------------------------------
;param: 1 =->Window Name ; 2 =->Control ID ; 3 =->Item NameBTW: ListBox can be use too
SelectComboBoxtem("Project Setting",7065,"Level 2")
Func SelectComboBoxtem($WinName,$ControlID,$ItemName)
ControlCommand ( $WinName, "",$ControlID, "SelectString" , $ItemName)
EndFunc
页:
[1]