CString CSAA7134DemoDlg::GetDirectory()
{
BROWSEINFO bi;
char name[MAX_PATH];
ZeroMemory(&bi,sizeof(BROWSEINFO));
bi.hwndOwner = AfxGetMainWnd()->GetSafeHwnd();
bi.pszDisplayName = name;
bi.lpszTitle = "请选择存放位置";
bi.ulFlags = BIF_RETURNONLYFSDIRS;
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
if(idl == NULL)
return "";
CString strDirectoryPath;
SHGetPathFromIDList(idl, strDirectoryPath.GetBuffer(MAX_PATH));
strDirectoryPath.ReleaseBuffer();
if(strDirectoryPath.IsEmpty())
return "";
if(strDirectoryPath.Right(1)!="\\")
strDirectoryPath+="\\";
return strDirectoryPath;
}
选择文件存放目录
最新推荐文章于 2022-04-16 10:00:22 发布