- //来自最近的一个程序,主体部分也是网上找的
- void CXBETaskDlg::OnButtonSetBaseDownPath()
- {
- // TODO: Add your control notification handler code here
- BROWSEINFO bi;
- TCHAR szDisplayName[MAX_PATH];
- LPITEMIDLIST pidl;
- LPMALLOC pMalloc = NULL;
- RtlZeroMemory(&bi, sizeof(bi));
- bi.hwndOwner = GetSafeHwnd();
- bi.pszDisplayName = szDisplayName;
- bi.lpszTitle = _T("请选择目录");
- bi.ulFlags = BIF_RETURNONLYFSDIRS;
- pidl = SHBrowseForFolder(&bi);
- if (pidl)
- {
- SHGetPathFromIDList(pidl, szDisplayName); //Set the directory name.
- strTaskBaseDir = szDisplayName; // strTaskBaseDir 是一个全局的CString
- SetDlgItemText(IDC_EDIT_BASEDOWNPATH, strTaskBaseDir);
- }
- // AfxMessageBox(strTaskBaseDir);
- }
SHBrowseForFolder的例子[SH]
最新推荐文章于 2013-12-10 17:53:24 发布
本文介绍了一个使用Windows API实现的文件夹选择对话框功能。该功能允许用户通过对话框选择一个目录,并将所选目录的路径显示在指定的编辑框中。此功能常见于软件配置界面,用于设置文件或数据的保存位置。
1117

被折叠的 条评论
为什么被折叠?



