I am adding a string sending a LB_ADDSTRING msg (invoke SendMessage, hwndListbox, LB_ADDSTRING, 0, offset UserSelectedFile), UserSelectedFile is from a openFileDialog box, now, It get's added fine, but I can't read it back, I am trying this:



invoke SendMessage, hwndListbox, LB_ADDSTRING, 0, offset UserSelectedFile
invoke SendMessage, hwndListbox, LB_GETCURSEL, 0, 0
invoke SendMessage, hwndListbox, LB_GETTEXT, EAX, addr ListBoxGetText
invoke MessageBox, hWnd, offset ListBoxGetText, addr ListBoxGetText, 0

ListBoxGetText is db MAX_PATH dup(?) and its a single-selection listbox. If I compare ListBoxGetText to 0, its always 1..
Posted on 2003-06-06 18:07:42 by KewLexX
I think I figured out the problem, no selection is made, I thought the item was selected after being added to the listbox, how can I get the newest item added to be selected?
Posted on 2003-06-06 18:12:54 by KewLexX
Actually I figured it out on my own, sry for useless post:



invoke SendMessage, hwndListbox, LB_ADDSTRING, 0, offset UserSelectedFile
invoke SendMessage, hwndListbox, LB_GETCOUNT, 0, 0
SUB EAX, 1
invoke SendMessage, hwndListbox, LB_SETCURSEL, EAX, 0
invoke SendMessage, hwndListbox, LB_GETCURSEL, 0, 0
invoke SendMessage, hwndListbox, LB_GETTEXT, EAX, addr ListBoxGetText
Posted on 2003-06-06 18:28:32 by KewLexX