怎么样获取CFileDialog地用户选择地文件过滤器
发布网友
发布时间:2022-11-21 11:05
我来回答
共1个回答
热心网友
时间:2024-10-15 10:11
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);
}
}