第1个回答 2012-08-15
UpdateData(TRUE);
BROWSEINFO bBinfo;
memset(&bBinfo, 0, sizeof(BROWSEINFO));
bBinfo.hwndOwner = m_hWnd;
bBinfo.lpszTitle = _T("请选择数据路径: ");
bBinfo.ulFlags = BIF_RETURNONLYFSDIRS;
char strTmp[255];
sprintf(strTmp,"");
LPITEMIDLIST lpDlist;
lpDlist = SHBrowseForFolder(&bBinfo) ;
if ( lpDlist != NULL )
{
SHGetPathFromIDList(lpDlist, strTmp);//把项目标识列表转化成目录
TRACE(strTmp);
m_OpenPath.Format("%s",strTmp);//=strTmp;
if (m_OpenPath.Right(1) != _T("\\")) // 得到如C:\这样的路径
m_OpenPath += _T("\\");
UpdateData(FALSE);
}
MessageBox(m_OpenPath);
m_OpenPath 为一个编辑框的 CString 的变量
第2个回答 2012-08-15
ShellExecute(NULL, "explore", "d:\\abc\\", NULL, NULL, SW_SHOWNORMAL);本回答被提问者采纳