Jump to content

Grabbing Listview


trids
 Share

Recommended Posts

I am following this with interest. Can I ask a question. If you fire up

Win2k or XP ;Network and Dialup Connections;Advanced;Advanced settings - you get A dialogue with 2 separate areas. AutoIt Window spy shows the top one as a ListView and the bottom section as a TreeView - is the TreeView just a subsection of a list view, are they related at all - or will the devs need to write different code to read a TreeView.

A bit of a boring question I'm afraid - but this stuff will eventually be really useful

Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 4 weeks later...

I know - the versioning is confusing :) .. there appear to be multiple version 3.0.103's distinguishable only by date.

One of mine is 2004-10-12 14:14 .. and works with ControlCommand().

HTH

Link to comment
Share on other sites

  • Administrators

Does the version of AutoItX from here support the ControlListView function?

http://www.hiddensoft.com/autoit3/files/unstable/autoitx/

I tried it but couldn't get the commands to work.  Also the .chm file in that directory says it v3.0.103 but does not list the ControlListView info.

AutoItX is not up to date with AutoIt - too much effort to keep up on both so I will update AutoItX after AutoIt gets released.
Link to comment
Share on other sites

  • 2 weeks later...

Is the ControlListView command limited to certain types of ListView.

I have scripts with ControlListView looking at "SysListView321" and "FolderView".

I have "SysListView321" working on an NT4 script - but I can't get "ListBox1" working on NT4. Should this work ?

;Run this on an NT4 PC
;Eventually - what I want to do is set the 'Allow Interact with desktop' flag for a couple of services
;The vbs stuff I use on Win2k doesn't work here
Run("rundll32.exe shell32.dll,Control_RunDLL srvmgr.cpl Services")
While 1
   If WinExists("Services") Then ExitLoop
   Sleep(500)
Wend
Sleep(1000)
WinActivate("Services")
$x = ControlListView ("Services", "", "ListBox1", "GetItemCount")
MsgBox(0, "debug", $x)

$x always = 0 - it can't read the ListBox1

Should this work ?

(or is there a better way of doing this - as I said - the vbs stuff I use on more up to date machines does not work here !!)

Thanks.

Link to comment
Share on other sites

I was looking to Start the services dialog box in NT4 - this works OK. The list of services is displayed as a ClassNN:ListBox1

I then wanted read in this list - select 5 of the services and do some work on them.

Yes you are right - it does show up as a ListBox rahter than a xxxList - as it was a standard windows dialog - I thought it might read it - :)

Link to comment
Share on other sites

The way I have done it in the past (before dllcall) was to send the down arrow key to the list, read the current item with ControlCommand and GetCurrentSelection, and loop that until I hit what I needed or hit the same thing more than once, indicating that I was at the end of the list. (Don't you just love run-on sentences?)

EDIT: It seems there could be a better way, including DllCall + SendMessage + LB_GETCOUNT

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

"... was to send the down arrow key to the list, read the current item with ControlCommand and GetCurrentSelection, and loop that until I hit what ...."

I'll give this a go -

Thanks alot

It would be nice to be able to pull up the dialog for a particular service directly - but I can't find anything about a dll call that will do it for me. AAAHHH!

Thanks again

Link to comment
Share on other sites

Been looking around, and this is what I came up with:

$LB_GETCOUNT = 0x18B
$LB_GETTEXT = 0x189
$hwnd = ControlGetHandle("Advanced TCP/IP Settings", "", "ListBox1")
$ret = DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $LB_GETCOUNT, "int", 0, "int", 0)
$items = $ret[0]
for $i = 0 to $items - 1
   $ret = DllCall("user32.dll", "int", "SendMessage", "hWnd", $hwnd, "int", $LB_GETTEXT, "int", $i, "str", "")
   msgbox(0,"",$ret[4])
Next

$ret[0] will give the amount of items in the listview.

I am still working on trying to get the text of the items, so hang on.

EDIT: Code above changed... Still working...

EDIT AGAIN: Code above is now done. It should give you the name of each item in the lsitbox, providing you change the values to accomodate your situation.

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

"... was to send the down arrow key to the list, read the current item with ControlCommand and GetCurrentSelection, and loop that until I hit what ...."

This didn't work.. :):)

I will modify your latest suggestions in the morning when I get access to the NT4 PC.

Thanks again for yor efforts - much appreciated

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...