I tried to modify your code from the original post:
The only thing I changed (added) are the 3 lines before the return statement.Code:{ /* Get index of current selection and the text of that selection. */ TCHAR buffer[200]; int index = SendMessage(m_hRecipients, CB_GETCURSEL, (WORD)0, 0L); SendMessage(m_hRecipients, CB_GETLBTEXT, (WPARAM)index, (LPARAM)buffer); //Get current contents of Edit Box int nLngth = SendMessage(m_hRecipients, WM_GETTEXTLENGTH, NULL, NULL); csRecipients = (TCHAR *)CoTaskMemAlloc(nLngth); SendMessage(m_hRecipients, WM_GETTEXT, nLngth+1, (LRESULT)csRecipients); // concat new selection to contents of Edit Box (current rescipient list) if (nLngth > 0) tcscat(csRecipients, L","); _tcscat(csRecipients, buffer); // set the new contents of the Edit Box ComboBox_SetText(m_hRecipients, (LPCWSTR)csRecipients); SendMessage(m_hRecipients, CB_DELETESTRING, index, 0L); SendMessage(m_hRecipients, CB_INSERTSTRING, index, (LPARAM)csRecipients); SendMessage(m_hRecipients, CB_SETCURSEL, index, 0L); return TRUE; }
I tried this (but with a MFC dialog). It was working for me.
So can you try out if this helps in your code?
Regards
PA




Reply With Quote