in my prog i wanna create a combobox and add some strings. this is the basic idea:
.data
ClassCombo db "combobox", 0
szText db "text", 0
; ... some code
; create combobox
invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr ClassCombo, NULL, WS_VISIBLE or WS_CHILD or CBS_DROPDOWNLIST, 115, 132, 60, 20, hWnd, NULL, hInstance, NULL
mov hCombo, eax
afterwards i want to add some strings with this:
invoke SendMessage, hCombo, CB_ADDSTRING, addr szText, 0
since i create the combo at startup, i also add the strings on program startup. BUT: the combobox does not display the strings. what's the hangup about this?
.data
ClassCombo db "combobox", 0
szText db "text", 0
; ... some code
; create combobox
invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr ClassCombo, NULL, WS_VISIBLE or WS_CHILD or CBS_DROPDOWNLIST, 115, 132, 60, 20, hWnd, NULL, hInstance, NULL
mov hCombo, eax
afterwards i want to add some strings with this:
invoke SendMessage, hCombo, CB_ADDSTRING, addr szText, 0
since i create the combo at startup, i also add the strings on program startup. BUT: the combobox does not display the strings. what's the hangup about this?
is it possible that i'm confusing wParam and lParam of the SendMessage API?
Yes, it is possible :grin:.
SendMessage(
(HWND) hWnd, // handle to destination window
CB_ADDSTRING, // message to send
(WPARAM) wParam, // not used; must be zero
(LPARAM) lParam // string to add (LPCTSTR)
);
well, i exchanged it --- but still nothing ... :(
If I'm not mistaken, the problem is with your CreateWindowEx. Change the height of the window to something bigger than 20. With combo boxes, the height doesn't mean the height of the control, but actually the list box that pops up. Basically, since the edit control portion of the combo box is roughly 24 pixels high, your list box is being obscured
--Chorus
--Chorus
thanks. that was it. the control was to small.