1.显示系统自带的图标

SHFILEINFO sfi;
 HIMAGELIST smalPic;
 HIMAGELIST bigPic;
 CString strBuf;
 char sysDir[300];
 memset(sysDir,0,sizeof(sysDir));
 GetWindowsDirectory(sysDir,300);
 strBuf=sysDir;
 sprintf(sysDir,"%s",strBuf.Left(strBuf.Find("javascript:void(0)));
 smalPic=(HIMAGELIST)SHGetFileInfo((LPCTSTR)strBuf,0,&sfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
 bigPic=(HIMAGELIST)SHGetFileInfo((LPCTSTR)strBuf,0,&sfi,sizeof(SHFILEINFO),SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
 if (smalPic||bigPic)
 {
  ::SendMessage(m_listControl.m_hWnd,LVM_SETIMAGELIST,(WPARAM)LVSIL_SMALL,(LPARAM)smalPic);
  ::SendMessage(m_listControl.m_hWnd,LVM_SETIMAGELIST,(WPARAM)LVSIL_NORMAL,(LPARAM)bigPic);

 }
 m_listControl.SetExtendedStyle(LVS_EX_GRIDLINES||LVS_EX_FULLROWSELECT);
 m_listControl.InsertColumn(0,"文件名",LVCFMT_LEFT,200);
 m_listControl.InsertItem(0,"folder",GetIndexIcon("",TRUE,FALSE));
 m_listControl.InsertItem(1,"text1",GetIndexIcon(".doc",FALSE,FALSE));
 m_listControl.InsertItem(2,"text2",GetIndexIcon(".txt",FALSE,FALSE));
 return TRUE;  // return TRUE  unless you set the focus to a control
}
int CShowSysIcoDlg::GetIndexIcon(LPCTSTR lpPath,BOOL isDir,BOOL isSelected)
{
 SHFILEINFO sfi;
 memset(&sfi,0,sizeof(sfi));
 if (isDir)
 {
  SHGetFileInfo(lpPath,FILE_ATTRIBUTE_DIRECTORY,&sfi,sizeof(sfi),SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|(isSelected?SHGFI_OPENICON:0));
  return sfi.iIcon;
 }
 else
 {
  SHGetFileInfo(lpPath,FILE_ATTRIBUTE_NORMAL,&sfi,sizeof(sfi),SHGFI_SMALLICON|SHGFI_SYSICONINDEX|SHGFI_USEFILEATTRIBUTES|(isSelected?SHGFI_OPENICON:0));
  return sfi.iIcon;
 }
 return -1;
}



2.