alexela Posted April 23, 2009 Share Posted April 23, 2009 How to get an ListView item's rect from another window?I want to click an area inside list view item. and the listview may have an scroll bar, and I may need to click the item outside the view. so my step is:1. scroll to the top, 2. get the item's rect, if any negative value returns, then, scroll to bottom, and get item's rect again.3. click positionBut the problem is I can't find any function to get the ListView item from another process's window.Here is what I got from Autoit Window Info:>>>> Window <<<<Title: 广告播放器Class: #32770Position: -342, 478Size: 678, 415Style: 0x16C0004CExStyle: 0x00050100Handle: 0x0002095E>>>> Control <<<<Class: SysListView32Instance: 1ClassnameNN: SysListView321Advanced (Class): [CLASS:SysListView32; INSTANCE:1]ID: 2385Text: Position: 372, 32Size: 297, 298ControlClick Coords: 130, 167Style: 0x50A10005ExStyle: 0x00000000Handle: 0x0002099E>>>> Mouse <<<<Position: 161, 726Cursor ID: 0Color: 0x000000>>>> StatusBar <<<<>>>> Visible Text <<<<更多消息喜欢讨厌一般投 票>>>> Hidden Text <<<<Anyone can Help?Thanks in advance!! Link to comment Share on other sites More sharing options...
bo8ster Posted April 23, 2009 Share Posted April 23, 2009 (edited) What do you mean by "rect"? Edit: _WinAPI_GetClientRect may be helpful Edited April 23, 2009 by bo8ster Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Authenticity Posted April 23, 2009 Share Posted April 23, 2009 Take a look in the help file, there are many _GUICtrlListView_* functions which enable to interact with an external list-view, unless it's an owner-drawn list-view which may complicate things. Link to comment Share on other sites More sharing options...
alexela Posted April 23, 2009 Author Share Posted April 23, 2009 (edited) Take a look in the help file, there are many _GUICtrlListView_* functions which enable to interact with an external list-view, unless it's an owner-drawn list-view which may complicate things.Thanks! I've tried all _GUICtrlListView_functions, nothing works.:;_GUICtrlListView_GetItemText(133470, 1) #133534 is handle of the listview_GUICtrlListView_GetItemText(133470, 1, 1)I don't know why, I'm sure it's not a owner-drawn listview since:ControlListView($hWnd, "", "SysListView321", "GetText", $idx, 1) can get the correct text!! Edited April 23, 2009 by alexela Link to comment Share on other sites More sharing options...
Authenticity Posted April 23, 2009 Share Posted April 23, 2009 Getting the handle is not the issue and you should not use a fix handle value but rather using ControlGetHandle('广告播放器', '', 'SysListView321') and then manipulate it's items using the _GUICtrlListView_* functions, like: Dim $hListView = ControlGetHandle('广告播放器', '', 'SysListView321') For $i = 0 To _GUICtrlListView_GetItemCount($hListView)-1 ConsoleWrite(_GUICtrlListView_GetItemText(hListView, $i) & @LF) Next Or something... Link to comment Share on other sites More sharing options...
bo8ster Posted April 23, 2009 Share Posted April 23, 2009 Can you post all your source? Use the code tags too please Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
alexela Posted April 23, 2009 Author Share Posted April 23, 2009 Getting the handle is not the issue and you should not use a fix handle value but rather using ControlGetHandle('广告播放器', '', 'SysListView321') and then manipulate it's items using the _GUICtrlListView_* functions, like: Dim $hListView = ControlGetHandle('广告播放器', '', 'SysListView321') For $i = 0 To _GUICtrlListView_GetItemCount($hListView)-1 ConsoleWrite(_GUICtrlListView_GetItemText(hListView, $i) & @LF) Next Or something... Thank you Authenticity: your code works! and thanks all you guys kindly help! The problem is I was using a fix value as handle just like Authenticity said. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now