since i havent found a thing about this, and it wont work in my prog, i'll ask it here:

after adding some strings to a combo thru
invoke SendMessage, hWnd, CB_ADDSTRING, 0, addr lpstrString
the program displays nothing in that list at startup. so i change the itemindex thru
invoke SendMessage, hWnd, CB_SETTOPINDEX, 0, 0.
but nothing happens.

when i have several items in that combo and want to determine the value of the active (shown) item thru
invoke SendMessage, hWnd, CB_GETTOPINDEX, 0, 0 ; ... eax == itemindex
invoke SendMessage, hWnd, CB_GETLBTEXT, eax, addr lpstrItem
the combo always returns the value with index 0. it doesnt matter which item is selected.

does anybody have a workaround? i'm kinda confused ... :confused:
Posted on 2002-10-11 14:59:23 by ploptor
I'm just guessing here.. but are you passing the right hWnd to SendMessage meaning the handle to your ComboBox ?
Posted on 2002-10-11 15:10:27 by JimmyClif
suppose this (NOT case-sensitive, i know):

invoke createwindowex, .......
mov hcombo, eax

invoke sendmessage, hcombo, cb_addstring, 0, lpstrString

and so on. but as i already said ... no way to get that index set, and no way to retrieve the data from the right itemindex.
Posted on 2002-10-11 15:14:52 by ploptor

if you want to get the Index Number and the text of the item which is selected, then you can just go like this

ComboBuffer DB 100 dup (0)
CurrentCBPos DD 0
hCombo DD 0

invoke SendMessage,hCombo,CB_GETCURSEL,0,0
mov CurrentCBPos,eax

invoke SendMessage,hCombo,CB_GETLBTEXT,CurrentCBPos,addr ComboBuffer

Maybe this helps in any way, otherwise, post more of your source.

Posted on 2002-10-12 01:18:05 by YaWNS
thanks, works just fine :)

but i still cannot set the active index, neither thru CB_SETTOPINDEX nor thru CB_SETCURSEL :(
Posted on 2002-10-12 08:02:11 by ploptor

that's weird.

      invoke SendMessage,hCombo,CB_SETCURSEL,2,0

works for me. It sets the selection to the 3rd (count starts by 0) item.
Did you check, if SendMessage returns CB_ERR in eax?

As I said, if you want, post some more code, and we can analyse it.

Greets YaWNS
Posted on 2002-10-12 14:02:42 by YaWNS
i got it to run, finally ... thanks anyway
Posted on 2002-10-31 05:17:06 by ploptor