Hallo,
I am experimenting a little with listview controls.
I have the following resource:
CONTROL "", IDC_LV_3, "SysListView32", LVS_REPORT|LVS_SINGLESEL|LVS_AUTOARRANGE|WS_BORDER|WS_TABSTOP, 0, 0, 212, 141
and this code:
HICON hStan, hKyle, hCartman, hKenny;
// Set up the image list.
images = ImageList_Create(48, 48, ILC_COLOR8 | ILC_MASK, 4, 1 );
hStan = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_STAN), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
hKyle = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_KYLE), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
hCartman = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CARTMAN), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
hKenny = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_KENNY), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
ImageList_AddIcon(images, hStan);
ImageList_AddIcon(images, hKyle);
ImageList_AddIcon(images, hCartman);
ImageList_AddIcon(images, hKenny);
DeleteObject(hStan);
DeleteObject(hKyle);
DeleteObject(hCartman);
DeleteObject(hKenny);
ListView_SetImageList(hList, images, LVSIL_SMALL);
LV_COLUMN LvCol = {0};
LV_ITEM LvItem = {0};
LvCol.mask = LVCF_TEXT|LVCFMT_LEFT|LVCF_WIDTH; // Type of mask
LvCol.cx = 250; // width between each coloum
LvCol.pszText = "South Park"; // First Header Text
// Add column
SendMessage(hList,LVM_INSERTCOLUMN, 0, (LPARAM)&LvCol);
LvItem.mask = LVIF_TEXT|LVIF_IMAGE;
LvItem.iImage = 0;
LvItem.pszText = "Stan Marsh";
ListView_InsertItem(hList, &LvItem);
LvItem.iImage = 1;
LvItem.pszText = "Kyle Brovlofsky";
ListView_InsertItem(hList, &LvItem);
LvItem.iImage = 2;
LvItem.pszText = "Eric Cartman";
ListView_InsertItem(hList, &LvItem);
LvItem.iImage = 3;
LvItem.pszText = "Kenny McCormick";
ListView_InsertItem(hList, &LvItem);
SendMessage(hList,LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE);
SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
But 'Stan' is not the first entry. The entrys are just in reverse order. What have I done wrong?