Sign in to follow this  
Followers 0
BigDaddyO

Will this DLL Call work

9 posts in this topic

I am attempting to retrieve all the information from a ComboBox with no luck using the current stable version of AutoIT. see my previous Post

I was lurking around and found a dllcall function that is only available in the beta version. There was a Post explaining some use with a link to combobox items. here is the code that was given.

$hwnd = ControlGethandle("...","...","...")
;ControlGethandle("title", "text", "classnameNN")

Global $CB_GETCURSEL = 0x0147

$i = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd,"int",$CB_GETCURSEL,"int", 0,"int", 0)

MsgBox(0,"","Item selected : " & $i[0])

ControlCommand ("..","...", "...","SetCurrentSelection",$i[0])

I am hoping that I can use CB_GETCOMBOBOXINFO to save all of the items in a combo box to a file. But before I download, install, and attempt to learn the Beta version I was wondering if someone could tell me if this will work.

Thanks,


Share this post


Link to post
Share on other sites



Well, SendMessage + CB_GETCOMBOBOXINFO requires a structure, that is NOT supported. But... (BIG BUT), even if you could call it, CB_GETCOMBOBOXINFO would not give you a list of the combobox's contents... is that what you want? a list of the contents?

Lar.

edit: you would need to loop through $CB_GETCURSEL starting at 0 until it fails...

Lar.

<{POST_SNAPBACK}>

Yes I want to get a list of the combo boxes contents. will the $CB_GetCursel retrieve all the information without selecting any items from the combobox? If any item is selected it can take up to 3 Minutes to load the item before I can continue on.

Share this post


Link to post
Share on other sites

Thanks for the info Larry,

I will download the unstable version and try that out.

Mike


Share this post


Link to post
Share on other sites

Larry,

You are always such a big help. You should change your avatar to a depiction of GOD holding an AutoIT symbol.

Mike


Share this post


Link to post
Share on other sites

I am sorry... it is CB_GETLBTEXT like...

here... test this on the combobox of the "Run" dialog...

$hwnd = ControlGethandle("Run","","ComboBox1")
;ControlGethandle("title", "text", "classnameNN")

Global $CB_GETLBTEXT =   0x0148

$i = 0
$list = ""

While 1
   $x = dllcall("user32.dll","int","SendMessage",_
          "hWnd",$hwnd,_
          "int",$CB_GETLBTEXT,_
          "int", $i,"str", "")
   If Not @error And $x[0] >= 0 Then
      $list = $list & $x[4] & @LF
   Else
      ExitLoop
   EndIf
   $i = $i + 1
WEnd
   
MsgBox(4096,"",$list)

<{POST_SNAPBACK}>

Very nice.

I noticed one problem though: try this with Windows explorer. At least I got just the first letter of every item on the list. With Run dialog it works correctly.

Can anybody explain why?

Share this post


Link to post
Share on other sites

I noticed one problem though: try this with Windows explorer. At least I got just the first letter of every item on the list. With Run dialog it works correctly.

Can anybody explain why?

<{POST_SNAPBACK}>

First thought : May be You got an unicode string from IE.

Share this post


Link to post
Share on other sites

This was intended for Combo Boxes. What control in Windows Explorer are you running this on?


Share this post


Link to post
Share on other sites

This was intended for Combo Boxes.  What control in Windows Explorer are you running this on?

<{POST_SNAPBACK}>

ComboBox1 :idiot:

That is the 'Address' combobox

Share this post


Link to post
Share on other sites

ComboBox1  :idiot:

That is the 'Address' combobox

<{POST_SNAPBACK}>

Is there anyone who can explain why comboboxes act differently?

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