How do I get an IShellFolder for a given folder name? I tried this:
dir is a std::wstring.Code:IShellFolder *pDesktop; HRESULT hr = SHGetDesktopFolder(&pDesktop); if(FAILED(hr)) throw hresult_exception(hr); LPITEMIDLIST piil; OLECHAR *pDir = new OLECHAR[dir.size()]; wcscpy(pDir, dir.c_str()); hr = pDesktop->ParseDisplayName(0, 0, pDir, 0, &piil, 0); delete[] pDir; if(FAILED(hr)) throw hresult_exception(hr); IShellFolder *pMine; hr = pDesktop->BindToObject(piil, 0, IID_IShellFolder, (void **)&pMine); pMalloc->Free(piil); if(FAILED(hr)) throw hresult_exception(hr);
The debugger shows the contents of dir as "G:\download\temp", which should be correct.
However, ParseDisplayName returns E_FAIL.
Does anyone know the reason? I need this for a nice tool that lets you apply a regular expression replace to each filename in a folder (great when downloading or ripping music).
Thanks in advance
CornedBee



LinkBack URL
About LinkBacks



CornedBee