找回密码
 加入
搜索
查看: 2376|回复: 2

[系统综合] listview切换后不能获得句柄?

[复制链接]
发表于 2014-8-11 18:19:40 | 显示全部楼层 |阅读模式
有一软件,左边是treeview控件,右边是listview控件,点击treeview项目则listview的内容会相应切换,句柄也会变换。
问题是:我只能获得最初所选listview的句柄,之后再切换到其他内容的listview,就得不到对应的句柄。如何解决?
 楼主| 发表于 2014-8-11 21:51:18 | 显示全部楼层
请看代码:
#include <GuiTreeView.au3>

$w="[CLASS:TdxW_MainFrame_Class]"
$id_TreeView="[id:59650]"
$id_listView="[id:100]"

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
 楼主| 发表于 2014-8-12 11:14:54 | 显示全部楼层
有人能答吗?谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-23 16:14 , Processed in 0.085165 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表