开发者

SHBrowseForFolder doesn't work for network selection in win7

开发者 https://www.devze.com 2022-12-11 01:29 出处:网络
I use SHBrowseForFolder in my code. It works well in XP. But I find it dose not run well in Windows 7 with the same code. When I click a network, it does nothing. But it can expand in XP.By the way, I

I use SHBrowseForFolder in my code. It works well in XP. But I find it dose not run well in Windows 7 with the same code. When I click a network, it does nothing. But it can expand in XP. By the way, I have the permission to access the network of another computer and I try accessing the resource with explorer, it's OK!

Can anyone tell me how 开发者_Python百科to fix this problem?


Not sure it is the help you wanted, but I found this on the function's MSDN page:

For Windows Vista or later, it is recommended that you use IFileDialog with the FOS_PICKFOLDERS option rather than the SHBrowseForFolder function. This uses the Open Files dialog in pick folders mode and is the preferred implementation.


It should be:

BROWSEINFO bi;  
// ..... omit oters
bi.ulFlags = /*BIF_DONTGOBELOWDOMAIN |*/ BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;

I add one more flag BIF_BROWSEFORCOMPUTER to the ulFlags


There is a mixup here of the FileDialog APIs of COMMDLG and the IFileDlg interface, the latter existing in Vista and Win2008 Server only.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号