如何让我的程序界面上显示的图标和WINDOWS桌面上显示的一模一样?包括快捷方式,文件夹和文件等等!

解决方案 »

  1.   

    ExtractAssociatedIcon()The ExtractAssociatedIcon function first looks for the indexed icon in the file specified by lpIconPath. If the function cannot obtain the icon handle from that file, and the file has an associated executable file, it looks in that executable file for an icon. Associations with executable files are based on file name extensions, are stored in the per-user part of the registry, and can be defined using File Manager's Associate command.
      

  2.   

    参考一下SHGetFileInfo之类的函数。
      

  3.   

    自己编写浏览器?网上好多示例代码,google...
      

  4.   

    SHGetFileInfo这个函数倒是可以取图标
    但是链接事件怎么做,思路简单一点的就好!
      

  5.   

    HWND   ChWnd=::GetWindow(hwDesktop,GW_CHILD);
      

  6.   

    取系统图标:
    void Cxxxx::EnableImages()
    {// Get the handle to the system image list, for our icons
        HIMAGELIST  hImageList;
        SHFILEINFO  sfi;    hImageList = (HIMAGELIST)SHGetFileInfo((LPCSTR)_T("C:\\"),
                                               0,
                                               &sfi, 
                                               sizeof(SHFILEINFO), 
                                               SHGFI_SYSICONINDEX | SHGFI_SMALLICON);    if (hImageList)
    {// Attach ImageList to TreeView
    m_Tree.SendMessage(TVM_SETIMAGELIST,(WPARAM)TVSIL_NORMAL,(LPARAM)hImageList);
     // Attach ImageList to ListView
      m_List.SendMessage(LVM_SETIMAGELIST,(WPARAM)LVSIL_SMALL,(LPARAM)hImageList);
    }
    }
      

  7.   

    这是如何调用
    ///
    int CStep1::GetItemIcon(CString path,UINT uFlags)
    {
       SHFILEINFO    sfi;   SHGetFileInfo((LPCSTR)path,0,&sfi,sizeof(SHFILEINFO),uFlags);   if(sfi.iIcon<0) sfi.iIcon=m_iO82Image;
    //
       return sfi.iIcon;
    }
    // for tree
    void Cxxxx::GetNormalAndSelectedIcons(CString path,LPTV_ITEM lptvitem)
    {
       //Note that we don't check the return value here because if GetIcon()
       //fails, then we're in big trouble...   lptvitem->iImage = GetItemIcon(path, //SHGFI_PIDL | 
    SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
       
       lptvitem->iSelectedImage = GetItemIcon(path,// SHGFI_PIDL | 
     SHGFI_SYSICONINDEX | SHGFI_SMALLICON |
      SHGFI_OPENICON);
       return;
    }