弹出的选择路径窗口 :
(1)选择文件夹目录的窗口。
//产生选择窗口
BROWSEINFO bi ;
char name[MAX_PATH];
bi.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
bi.pszDisplayName = name;
bi.ulFlags = BIF_RETURNFSANCESTORS;
//记录选择的路径到 strDirectoryPath
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
CString strDirectoryPath;
SHGetPathFromIDList(idl,strDirectoryPath.GetBuffer(MAX_PATH));
strDirectoryPath.ReleaseBuffer();
(2)选择文件目录的窗口
//显示打开文件对话框
CFileDialog dlg(true, "Access Files",NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Access数据库文件(*.mdb)|*.mdb||",this)
if(dlg.DoModal() != IDOK)
return ;
//记录路径
CString resultFilePath;
resultFilePath = dlg.GetPathName();