用CFileDialog是不能实现的, 试用下面的代码.
#include <shlobj.h>
CString strFilePath;
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("Ñ¡Ôñ²¥³ö±í·¾¶");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL)
{
if(SHGetPathFromIDList(pidl, pszBuffer))
{
CString strTemp(pszBuffer); strFilePath = strTemp;
if (strFilePath.GetLength() <= 1)
{
}
else if (strFilePath.Right(1) != _T("\\"))
strFilePath += _T("\\");
}
}
GetDlgItem(IDC_STATIC_PATH)->SetWindowText(strFilePath);