Jump to content

Getting the items in a ListView (or ListBox)


Recommended Posts

I have a control that I couldn't figure out whether it is a ListBox or a ListView. So, I tried to use both ControlCommand and ControlListView & ControlCommand consistently gave errors, which makes me think it might be ListView. Here is the info from the window info tool:

>>>> Control <<<<

Class: ATL:0048B110

Instance: 1

ClassnameNN: ATL:0048B1101

Name:

Advanced (Class): [CLASS:ATL:0048B110; INSTANCE:1]

ID: 10129

Text:

Position: 81, 218

Size: 272, 90

ControlClick Coords: 113, 38

Style: 0x50010081

ExStyle: 0x00000000

Handle: 0x000F097E

>>>> Mouse <<<<

Position: 617, 666

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Button1

Make the following selection to complete the connection.

Please select a &Role:

&Save settings

&Connect

C&ancel

>>>> Hidden Text <<<<

&Info

&Retry

&Upgrade

C&lose

&Continue

Here is what I tried on the above control:

val = ControlListView("Pulse", "Make the following selection to complete the connection.", "[ID:10129]", "GetItemCount", "", "")
ConsoleWrite ("Item Count: " & $val & @CRLF & "ControlListView error: " & @error & @CRLF)
ConsoleWrite( "Current Selection: " & ControlCommand('Pulse', 'Make the following selection to complete the connection.', '[ID:10209]', "GetCurrentSelection", "") & @CRLF & "ControlCommand error: " & @error & @CRLF)

and here is the output I get:

Item Count: 0

ControlListView error: 0

Current Selection: 0

ControlCommand error: 1

So, it seems it is a ListView but for some reason I cannot get any method to get any result on that control. Any ideas what might be wrong? Thanks.

Link to comment
Share on other sites

Turns out it is a ListBox. I used Win32 API (SendMessage) directly & send the LB_GETCOUNT message to the control & I got the right number of items listed in the control. So why is that the ControlCommand is failing on any method I use on that control? Am I missing some params?

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