要实现用户自定义浏览文件夹(不是目录选择,是用户提供文件夹绝对路径),我使用如下方法,但是我该如何得到pidl呢? IShellBrowser* m_pSB=GetShellBrowser();
m_pSB->BrowseObject(pidl,SBSP_SAMEBROWSER|SBSP_DEFMODE );

解决方案 »

  1.   

    SHGetPathFromIDList(vItemIDList, vFileName);
      

  2.   

    SHParseDisplayName Function--------------------------------------------------------------------------------Translates a Shell namespace object's display name into an item identifier list and returns the attributes of the object. This function is the preferred method to convert a string to a pointer to an item identifier list (PIDL).SyntaxHRESULT SHParseDisplayName(          LPCWSTR pszName,
        IBindCtx *pbc,
        LPITEMIDLIST *ppidl,
        SFGAOF sfgaoIn,
        SFGAOF *psfgaoOut
    );
      

  3.   

    //通过SHGetDesktopFolder()得到IDesktopFolder接口
    //IDesktopFolder::ParseDisplayName()方法得到ID
    SHGetDesktopFolder(IDesktopFolder);
    IDesktopFolder.ParseDisplayName(Handle, NULL, vFileName, Eaten, vItemIDList, Flags);
      

  4.   

    有那么麻烦吗?应该这个吧!
    [Now Supported on Windows NT]Converts an item identifier list to a file system path.WINSHELLAPI BOOL WINAPI SHGetPathFromIDList(    LPCITEMIDLIST pidl, 
        LPSTR pszPath
       );
     ParameterspidlPointer to an item identifier list that specifies a file or directory location relative to the root of the name space (the desktop).pszPathPointer to a buffer that receives the file system path. The size of this buffer is assumed to be MAX_PATH bytes. Return ValuesReturns TRUE if successful or FALSE if an error occurs ?for example, if the location specified by the pidl parameter is not part of the file system.