获取目录对话框
BROWSEINFO bi;
char szPathName[MAX_PATH];
char szTitle[] = "选择路径";
ZeroMemory(&bi, sizeof(BROWSEINFO));
bi.hwndOwner = GetSafeHwnd();
bi.pszDisplayName = szPathName;
bi.lpszTitle = szTitle;
bi.ulFlags = 0x0040 ;
CString str;
CString strDir; //选择的目录
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
if(idl == NULL)
{
strDir= "";
return;
}
SHGetPathFromIDList(idl, str.GetBuffer(MAX_PATH * 2));
str.ReleaseBuffer();
if(str != "" && str.GetAt(str.GetLength() - 1) != '\\')
str += "\\";
strDir = str;