ListView加入系统图标时,出现运行后,桌面等图标消失了(高分)
HIMAGELIST hSystemSmallImageList, hSystemLargeImageList;
SHFILEINFO ssfi, lsfi;
//get a handle to the system small icon list
hSystemSmallImageList =
(HIMAGELIST)SHGetFileInfo(
(LPCTSTR)_T("C:\\"),
0,
&ssfi,
sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
//attach it to the small image list
//--DON'T FORGET TO PUT m_smallImageList.Detach(); in your destructor
m_SmallImgList.Attach(hSystemSmallImageList);
//do the same for the large
hSystemLargeImageList =
(HIMAGELIST)SHGetFileInfo(
(LPCTSTR)_T("C:\\"),
0,
&lsfi,
sizeof(SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_ICON);
m_LargeImgList.Attach(hSystemLargeImageList);
//Set the list control image list
GetListCtrl().SetImageList(&m_SmallImgList, LVSIL_SMALL);
GetListCtrl().SetImageList(&m_LargeImgList, LVSIL_NORMAL);
加到OnInitialUpdate(),程序一运行,图标还在,结束后,系统图标都消失了,不知道是什么原因,望予以解决.