I've this code that should get the itemID when created and change the code, but it never changes it(At least with my code) and I want to change the item that I select with "LB_ADDSTRING" with "LB_SETITEMDATA". How could I do this? Thanks!
hWndList = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("listbox"), "", LBS_HASSTRINGS | WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_AUTOVSCROLL, 0, ScreenAddaptX(10)+30, ScreenAddaptX(100), ScreenAddaptY(40), hwnd, (HMENU)105, NULL, NULL);
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"Downloading Test at 50%");
int nItem = SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)"Downloading Test1 at 70%");
SendMessage(hWndList, LB_SETITEMDATA, (WPARAM)nItem, (LPARAM)"Downloading Test1 at 90%");
LB_SETITEMDATA sets a user-defined value associated with the specified item in a list box.
It is not used for changing the item's text.
However, it appears you are trying change the text. For some reason, there is no message for that action, so you have to delete the item and insert a new item with the desired text.
int nItem = 1; SendMessage(list, LB_DELETESTRING, nItem, 0); SendMessage(list, LB_INSERTSTRING, nItem, (LPARAM)"Downloading Test1 at 90%");