Hey!
I'm having a bit of trouble simply adding a string to an empty listbox in C++ WinAPI. The Listbox is initialised as follows:
I've tried adding a string as follows, but to no avail: (I have only included relevant lines)
I've tried one or two other methods of adding a string, but I can't see why this isn't working. the output is just an empty list box
(this code is included under a WM_CREATE message under the hwndObjectives window which contains the list box)
I'm having a bit of trouble simply adding a string to an empty listbox in C++ WinAPI. The Listbox is initialised as follows:
# hwndObjList = CreateWindowEx(0, TEXT("LISTBOX"), TEXT(""), WS_CHILD | WS_VISIBLE | WS_BORDER| LBS_STANDARD|LBS_HASSTRINGS, 20, 185, 170, 95, hwndObjectives, (HMENU) IDOBJLIST , NULL, NULL);
I've tried adding a string as follows, but to no avail: (I have only included relevant lines)
string szObjectivesArray[noObjectives][2]; string* buffer = &szObjectivesArray[0][0]; for (int Counter = 0; Counter < noObjectives; Counter++) { GetFirstIndex(file, ((Counter + 1) * 2) - 1, szObjectivesArray[Counter][0]); GetSecondIndex(file, ((Counter + 1) * 2) - 1, szObjectivesArray[Counter][1]); } SendMessage(hwndObjList, LB_ADDSTRING, NULL, (LPARAM)buffer);
I've tried one or two other methods of adding a string, but I can't see why this isn't working. the output is just an empty list box
(this code is included under a WM_CREATE message under the hwndObjectives window which contains the list box)