hi, im having a problem setting a listview with 2 different icons, i do the same thing on init and it works, but in this function it uses the same icon for both
Code:
/*i have place messagebox's in there to see if the code is getting exucuted
and it is, the problem is that it keeps using the same icon for both */
int SetUserList()
{
int i;
HIMAGELIST hSmallIcons;
SendMessage(hwndNameList, LVM_DELETEALLITEMS, (WPARAM)0, (LPARAM)0);
hSmallIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 1, 1);
ImageList_AddIcon(hSmallIcons, hUserIcon);
ImageList_AddIcon(hSmallIcons, hAdminIcon);
ListView_SetImageList(hwndNameList, hSmallIcons, LVSIL_SMALL);
for(i = 0; i < 20; i++)
{
if(UserDetails[i].Used == TRUE)
{
if(UserDetails[i].Type == 1)
{
lvItem.cchTextMax = 20;
lvItem.pszText= UserDetails[i].UserName;
lvItem.iImage=0;
SendMessage(hwndNameList,LVM_INSERTITEM,0,(LPARAM)&lvItem);
}
}
}
for(i = 0; i < 20; i++)
{
if(UserDetails[i].Used == TRUE)
{
if(UserDetails[i].Type == 0)
{
lvItem.cchTextMax = 20;
lvItem.pszText= UserDetails[i].UserName;
lvItem.iImage=1;
SendMessage(hwndNameList,LVM_INSERTITEM,0,(LPARAM)&lvItem);
}
}
}
return 0;
}