列表框显示图标问题

static CImageList ProcessImg; 定义在头文件

str->InsertItem(0, pe32.szExeFile, imageIndex);  imageIndex对应图标索引 0 1 2 3这样排列

hImageList = (HIMAGELIST)::SHGetFileInfo(tsFileDosPath, 0, &shfileinfo, sizeof(shfileinfo), SHGFI_ICON);
        if (hImageList == 0)
        {
                ProcessImg.Add(AfxGetApp()->LoadIcon(IDR_MAINFRAME));
        }
        else
        { 
                ProcessImg.Add(shfileinfo.hIcon);
        }
            str->SetImageList(&ProcessImg, LVSIL_SMALL);
原文地址:https://www.cnblogs.com/IMyLife/p/4826151.html