c++ - How to get a PIDL from a Windows library's GUID? -


how can pidl of library guid?

for example, if have guid of documents library ("{7b0db17d-9cd2-4a93-9733-46cc89022e7c}"), how can convert library's id list?

i thought shparsedisplayname job, returns "file not found."

bear in mind need pidl of library, not of default folder.

this straight c++, no .net.

tia

edit: code works, response below (without error checks). guid guid string prepended 'shell:::', e.g., 'shell:::{7b0db17d-9cd2-4a93-9733-46cc89022e7c}'.

ishellfolder* pdesktop; lpitemidlist pidl; shgetdesktopfolder(&pdesktop); pdesktop->parsedisplayname(nullptr, nullptr, guid, nullptr, &pidl, 0); 

edit 2: easier: shparsedisplayname works if 'shell:::' prepended:

shparsedisplayname(guid, nullptr, &pidl, 0, nullptr);  

according documentation ishellfolder::parsedisplayname can pass filename in form ::{guid} if using desktop folder.

edit: documentation appears incomplete, according this answer need add shell: start of string.

p->parsedisplayname(m_hwnd, null, _t("shell:::{7b0db17d-9cd2-4a93-9733-46cc89022e7c}"), null, &pidl, null); 

Comments