zjsong 发表于 2014-8-11 18:19:40

listview切换后不能获得句柄?

有一软件,左边是treeview控件,右边是listview控件,点击treeview项目则listview的内容会相应切换,句柄也会变换。
问题是:我只能获得最初所选listview的句柄,之后再切换到其他内容的listview,就得不到对应的句柄。如何解决?

zjsong 发表于 2014-8-11 21:51:18

请看代码:#include <GuiTreeView.au3>

$w=""
$id_TreeView=""
$id_listView=""

WinActivate ($w)
WinWait($w, "", 5)
$h_TreeView= ControlGetHandle($w, "",$id_TreeView )

;select TreeView item AA
ControlTreeView($w, "", $id_TreeView, "Select", "AA")
$h_treeItem=_GUICtrlTreeView_GetSelection($h_TreeView )
_GUICtrlTreeView_ClickItem($h_TreeView , $h_treeItem, "left", False, 1)

$h_listview_1=ControlGetHandle($w, "",$id_listView );get correct listvieew handle
$itemtext_1=ControlListView ($w, "", $id_listView, "GetText" ,0,0);get correct text

;select TreeView item BB
ControlTreeView($w, "", $id_TreeView, "Select", "BB")
$h_treeItem=_GUICtrlTreeView_GetSelection($h_TreeView )
_GUICtrlTreeView_ClickItem($h_TreeView , $h_treeItem, "left", False, 1)

$h_listview_2=ControlGetHandle($w, "",$id_listView );get wrong listvieew handle
$itemtext_2=ControlListView ($w, "", $id_listView, "GetText" ,0,0);get wrong text

zjsong 发表于 2014-8-12 11:14:54

有人能答吗?谢谢
页: [1]
查看完整版本: listview切换后不能获得句柄?