views:

142

answers:

3

Hi,

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 to fix this problem?

Thanks in advance!

A: 

Not sure it's 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.

Traveling Tech Guy
Thanks, I will try later.But I want to find a solution that can run my app under XP and also later windows.
Dan
I believe IFileDialog works well in XP. It's SHBrowseForFolder that doesn't work in newer systems.
Traveling Tech Guy
Thanks! but even it works in Win7, but this function is not support in XP.It's that any api that support both? Thanks
Dan
FileDialog works in XP, and even in 98, if I recall correctly.
Traveling Tech Guy
A: 

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

Dan
A: 

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

Christian