如何用CFileDialog得到一个文件夹的路径
2个回答
2015-10-10 · 知道合伙人软件行家
关注
展开全部
code:
void CFindFileDlg::OnButton1()
{
// TODO: Add your control notification handler code here
BROWSEINFO bInfo;
ZeroMemory(&bInfo,sizeof(bInfo));
bInfo.hwndOwner = m_hWnd;
TCHAR tchPath[255];
bInfo.lpszTitle = _T( "所选择路径: ");
bInfo.ulFlags = BIF_RETURNONLYFSDIRS;
LPITEMIDLIST lpDlist;
//用来保存返回信息的IDList,使用SHGetPathFromIDList函数转换为字符串
lpDlist = SHBrowseForFolder(&bInfo) ; //显示选择对话框
if(lpDlist != NULL)
{
SHGetPathFromIDList(lpDlist,tchPath);//把项目标识列表转化成目录
// TRACE(tchPath);
SetDlgItemText(IDC_EDIT1,tchPath);
}
}
void CFindFileDlg::OnButton1()
{
// TODO: Add your control notification handler code here
BROWSEINFO bInfo;
ZeroMemory(&bInfo,sizeof(bInfo));
bInfo.hwndOwner = m_hWnd;
TCHAR tchPath[255];
bInfo.lpszTitle = _T( "所选择路径: ");
bInfo.ulFlags = BIF_RETURNONLYFSDIRS;
LPITEMIDLIST lpDlist;
//用来保存返回信息的IDList,使用SHGetPathFromIDList函数转换为字符串
lpDlist = SHBrowseForFolder(&bInfo) ; //显示选择对话框
if(lpDlist != NULL)
{
SHGetPathFromIDList(lpDlist,tchPath);//把项目标识列表转化成目录
// TRACE(tchPath);
SetDlgItemText(IDC_EDIT1,tchPath);
}
}
2015-10-10
展开全部
zerytey
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询