Jump to content
Sign in to follow this  
zjsong

can't get handle since ListView changed?

Recommended Posts

zjsong
 
I have a software, that TreeView on left side and ListView on right. Once select different items on TreeView then ListView will change, also its handle change.
 
The problem is I can't get the handle of changed ListView and its items, I can get the first one only. 
 
how to do in this case? Thanks for your help
 
 
#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

Share this post


Link to post
Share on other sites
zjsong

anyone can answer? 

Share this post


Link to post
Share on other sites
JohnOne

Without having or knowing the software it's very difficult, but I'd say your problem almost certainly lies here...

$id_listView="[id:100]"

If the ID is changing then obviously you will not get your control.

Show the summary tab of listview from window info tool before and after you select new treeview item.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
zjsong

Without having or knowing the software it's very difficult, but I'd say your problem almost certainly lies here...

$id_listView="[id:100]"

If the ID is changing then obviously you will not get your control.

Show the summary tab of listview from window info tool before and after you select new treeview item.

hi John,

the listview ID do not change but its handle and instance changed, and the old listview is hide. Thanks 

 

before:

 

>>>> Control <<<<
Class: SysListView32
Instance: 1
ClassnameNN: SysListView321
Name:
Advanced (Class): [CLASS:SysListView32; INSTANCE:1]
ID: 100
Text:
Position: 218, 492
Size: 993, 233
ControlClick Coords: 414, 95
Style: 0x50500009
ExStyle: 0x00020000
Handle: 0x000205B0
 
 
after:
 
>>>> Control <<<<
Class: SysListView32
Instance: 2
ClassnameNN: SysListView322
Name:
Advanced (Class): [CLASS:SysListView32; INSTANCE:2]
ID: 100
Text:
Position: 218, 478
Size: 1057, 247
ControlClick Coords: 102, 48
Style: 0x50500009
ExStyle: 0x00020000
Handle: 0x00020614
 
 
I can't get new handle ......
Edited by zjsong

Share this post


Link to post
Share on other sites
zjsong

What if you go back to the prior treeview item, does the listview instance return of go to 3?

 

No, it always keep instance as 1. When I click new item in TreeView it will create a new instance and new handle for ListView that have same ID, and then those instance/handle always keep their own number. The old listviews are hidden till go back.

I just want get handle of 2, 3, 4.... but it only give me handle of 1. 

Share this post


Link to post
Share on other sites
zjsong

Thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×