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:
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:
I'm just guessing here.. but are you passing the right hWnd to SendMessage meaning the handle to your ComboBox ?
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.
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.
Hi,
if you want to get the Index Number and the text of the item which is selected, then you can just go like this
Maybe this helps in any way, otherwise, post more of your source.
YaWNS
if you want to get the Index Number and the text of the item which is selected, then you can just go like this
.data
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.
YaWNS
thanks, works just fine :)
but i still cannot set the active index, neither thru CB_SETTOPINDEX nor thru CB_SETCURSEL :(
but i still cannot set the active index, neither thru CB_SETTOPINDEX nor thru CB_SETCURSEL :(
Hi,
that's weird.
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
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
i got it to run, finally ... thanks anyway