MFC CFileDialog - Getting special folder path on windows 7

1.2k Views Asked by At

All.

I have some problem during writing an mfc application. It is using the sample project, posted on below url, to implement multiple selection on CFileDialog.

http://www.codeproject.com/KB/MFC/SelectDialog.aspx

It works fine on Windows Xp but has one problem on Windows 7. The problem is that CFileDialog::GetFolderPath returns the empty string about the windows special folders such as Library/Documents on Windows 7. So I tried like below.

if (FileDialog.DoModal() == IDOK) {
    tFolder = FileDialog.GetPathName();
}

This functions looks fine but It doesn't work when I select the folder on dialog.

Who can help me?

Waiting your answers... Regards.

1

There are 1 best solutions below

0
On

I guess the problem is that Win7 libraries do not have have a path in the file system (Actually, they are kind of an alias for a collection of paths).