I have added a list box on a dialog box with the name "IDLIST"
Now I want to change the text of that dialog when the item(s) are selected in the list box. I used the following code:
But it gives me these errors:Code:int count; HWND hlist = GetDlgItem(hwnd, IDCLIST); count = SendMessage(hlist, LB_GETSELCOUNT, 0,0); int *buffer1 = GlobalAlloc(GPTR, sizeof(int) * count); SendMessage(hlist, LB_GETSELITEMS, (WPARAM)count, (LPARAM)buffer1); SetWindowText(hwnd, buffer1); GlobalFree(buffer1);
cannot convert from 'void *' to 'int *'
error C2664: 'SetWindowTextA' : cannot convert parameter 2 from 'int *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2440: '=' : cannot convert from 'void *' to 'char *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Do you know why its giving me these errors and how can I fix them.




Reply With Quote