Jump to content

How to get an ListView item's rect from another window


Recommended Posts

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 position

But 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: #32770

Position: -342, 478

Size: 678, 415

Style: 0x16C0004C

ExStyle: 0x00050100

Handle: 0x0002095E

>>>> Control <<<<

Class: SysListView32

Instance: 1

ClassnameNN: SysListView321

Advanced (Class): [CLASS:SysListView32; INSTANCE:1]

ID: 2385

Text:

Position: 372, 32

Size: 297, 298

ControlClick Coords: 130, 167

Style: 0x50A10005

ExStyle: 0x00000000

Handle: 0x0002099E

>>>> Mouse <<<<

Position: 161, 726

Cursor ID: 0

Color: 0x000000

>>>> StatusBar <<<<

>>>> Visible Text <<<<

更多消息

喜欢

讨厌

一般

投 票

>>>> Hidden Text <<<<

Anyone can Help?

Thanks in advance!!

Link to comment
Share on other sites

What do you mean by "rect"?

Edit: _WinAPI_GetClientRect may be helpful

Edited 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

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 by alexela
Link to comment
Share on other sites

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

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...