MFC 打开目录窗口

char szPath[MAX_PATH];     //存放选择的目录路径 

CString str;

ZeroMemory(szPath, sizeof(szPath));

BROWSEINFO bi;
memset(&bi, 0, sizeof(bi));
bi.hwndOwner = m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = (LPWSTR)szPath;
char tips[] = "请选择需要打开的目录:";
TcharToChar(bi.lpszTitle, tips);
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
//弹出选择目录对话框
LPITEMIDLIST lp = SHBrowseForFolder(&bi);
memset(m_saveFilePath, 0, 150);


if (lp && SHGetPathFromIDList(lp, bi.pszDisplayName))
{
MessageBox(bi.pszDisplayName);

}



你可能感兴趣的:(MFC)