c++ - IFileDialog / IShellItem::GetDisplayName doesn't work with Windows 7 libraries -
ifiledialog *pfd; ... cocreateinstance(clsid_fileopendialog,null, clsctx_inproc_server,iid_ppv_args(&pfd)); ... ishellitem *psiresult; pfd->getresult(&psiresult); ... wchar_t *filepath; psiresult->getdisplayname(sigdn_filesyspath,&filepath); ...
this works regular files fails (e_invalidarg) when file fetched via windows 7 library folder (the same file work when accessed via it's normal path). doc says :
sigdn_filesyspath (returns item's file system path, if has one. items report sfgao_filesystem have file system path. when item not have file system path, call ishellitem::getdisplayname on item fail. in ui name suitable display user in cases, note might not specified items.
but using sigdn_normaldisplay or others sigdn enumeration fails too.
so how full path when file fetched via windows 7 libraries ?
edit 1
i can folder via :
ishellitem *psiresult; pfd->getfolder(& psiresult); lpwstr folderpath = null; psiresult->getdisplayname(sigdn_filesyspath, & folderpath);
but getdisplayname() doesn't work pfd->getresult(& psiresult);
edit 2
i found not working, in coinitializeex. used coinit_multithreaded, if change coinit_apartmentthreaded works.
try calling
pfd->setoptions(dwoptions | fos_forcefilesystem | fos_pathmustexist);
before showing dialog. works me.
Comments
Post a Comment