请问怎样获取别的程序的图标``并加载到ListCtrl里去?求代码``代码必须经过测试```

解决方案 »

  1.   

    //szPath是程序路径,m_List是ListCtrl,m_Imagelist是CImageList。SHFILEINFO    shinfo;
    m_Imagelist.Create(16,16,ILC_COLOR24,0,0);
    m_List.SetImageList(&m_Imagelist,LVSIL_SMALL);
    SHGetFileInfo(szPath,0,&shinfo,sizeof(shinfo),SHGFI_ICON);
    index = m_List.InsertItem(index,szCaption,m_Imagelist.Add(shinfo.hIcon));
    m_List.SetItemText(index,1,szPath);
      

  2.   

    常见用法如上,不多说了
    HICON ExtractIcon(
      HINSTANCE hInst,          // instance handle
      LPCTSTR lpszExeFileName,  // file name
      UINT nIconIndex           // icon index
    );UINT ExtractIconEx(
      LPCTSTR lpszFile,        // file name
      int nIconIndex,          // icon index
      HICON *phiconLarge,      // large icon array
      HICON *phiconSmall,      // small icon array
      UINT nIcons              // number of icons to extract
    );