As global:Code:typedef struct { HINSTANCE hInstance; HWND hListView; char* szNombre; char* szPC; } CLIENTESINFO, *LPCLIENTESINFO;
First calling is from a child dialog proc.Code:CLIENTESINFO ci;
Second call is from the main WinProc:Code:char nom[128], pc[12]; GetDlgItemText(hDlg, IDC_EDIT1, nom, sizeof(nom)+1); ci.szNombre = nom; GetDlgItemText(hDlg, IDC_EDIT2, pc, sizeof(pc)+1); ci.szPC = pc;
InsertItem prototype:Code:char t[12]; int total = ListView_GetItemCount(ci.hListView); wsprintf(t, "%i", total+1); InsertItem(ci.hListView, total, 0, t); // t is current position and it shows correctly InsertItem(ci.hListView, total, 1, ci.szNombre); // empty string
Now my question is, why the listview always shows a empty string? Isn't the struct global? ThanksCode:void InsertItem(HWND hList, int iItemNo, int iSubNo, char *lpszText) { LVITEM item = {0}; item.mask = LVIF_TEXT; item.pszText = lpszText; item.iItem = iItemNo; item.iSubItem = iSubNo; if (iSubNo == 0) ListView_InsertItem(hList, &item); else ListView_SetItem(hList, &item); return; }



LinkBack URL
About LinkBacks


