Add String To Combobox?
I have created a combo box:
hWndServer = CreateWindow("COMBOBOX", "", WS_CHILD | WS_VISIBLE | CBS_DROPDOWN
200, 20, hWnd, (HMENU)ID_SERVER, hInstance, NULL);
That works fine. How do i add strings to the combo box? i assume i use send message.
And also do i just use GetWindowText() to get the current selection?
You can send your combo box an CB_ADDSTRING message to add a string -
and get the selected item's index with CB_GETCURSEL -
int theIndex = SendMessage(hWndServer,CB_GETCURSEL,0,0);
You can then get the text that corresponds with this index by sending a CB_GETLBTEXT message with your WPARAM as the index number and the LPARAM as the buffer to recieve the text (if you need the length of text you can send a CB_GETLBTEXTLEN message).