Modifying items in Combo Box

Is it possible to modify the text of items inside a Combo Box? I have a Combo Box in a modal dialog and a background thread which needs to modify the items in it as new information becomes available. The dialog is created as

[code]programNum =
(LONG) &programs_ );[/code]

Inside the message loop for the dialog (in "case WM_TIMER:"), I pass the CB_SETITEMDATA message to the combo box like so:

[code]HWND list = GetDlgItem(hDlg, IDC_COMBO_MPTS);
res = SendMessage((HWND) list,
(LPARAM) (LPCTSTR)"aaaaaaaa");[/code]

But, for some reason, the text in first item of the combo box never changes. I am able (in exactly the same spot in the code) to add items to the list with CB_ADDSTRING.

Reference: [link=][/link]


  • [color=Blue]The only way is to replace the item. Remove the item, then re-insert the new text. CB_SETITEMDATA works only for owner drawn combo boxes. In standard box, this message will only associate some 32-bit value to the item, but it will not change its text.[/color]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion