Jump to content

Get number of entries in a list box?


Recommended Posts

As the title says, is there a way to do this? I want to loop through all instances in a ListBox, which I can select using

ControlCommand("title","text",controlID,SetCurrentSelection",occurrence)

but I don't know how to find out how many entries are in the list box to know how many I need to loop through.

Is this do-able?

Chris

Link to comment
Share on other sites

You can use sendmessage with dllcall to find the total amount of items.

$LB_GETCOUNT = 0x18B
$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]
Who else would I be?
Link to comment
Share on other sites

Good 'ol DLLCall, was sure someone would know what to do...

As an aside, does anyone know why whenever I get an e-mail from a topic I've subscribed to on the forum that contains a code sample it contains loads of "&#40", "&#34" and the likes in it - tried to post an example, but it doesn't display them!

Edited by Chris_1013
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...