Sign in to follow this  
Followers 0
Chris_1013

Get number of entries in a list box?

3 posts in this topic

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0