问题
When a user has navigated in the Windows Explorer to e.g. a folder on the SD-card of his Android phone, the Explorer shows a kind of breadcrumb path like "This PC\Galaxy Tab A\Card\Folder1"
when one clicks in the address bar.
Windows Explorer also accepts these kind of paths when entering or copying them in the address bar and pressing return.
I wonder if there is a way to parse these kind of breadcrumb paths using the Shell API and get a PItemIDList
or IShellItem
in return. So far I did not succeeed using e.g. SHParseDisplayName()
. This code
LPITEMIDLIST itemidlist;
HRESULT hr = SHParseDisplayName(L"This PC\\Galaxy Tab A\\Card\\testfolder", NULL, &itemidlist, 0, NULL);
returned 0x80070002
as HRESULT
.
The question SHParseDisplayName when path doesn't exists deals with the question how to use an IBindCtx
to parse a path to a file that does not yet exists. This can be done using STR_FILE_SYS_BIND_DATA bind context. But the objects on a mobile device are no file system data and they do already exist, so I don't see why this is a duplicate.
来源:https://stackoverflow.com/questions/37000602/how-to-parse-explorer-breadcrumb-path-like-this-pc-galaxy-tab-a-card-folder1-u