如何实现vc的那种目录对话框?

tserpent 2003-06-26 12:29:15
我用SHBrowseForFolder(),又不能设置开始选择目录。如果我用pidlRoot,他又只有这个目录下的东西,而没有其他目录了。
...全文
68 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tserpent 2003-06-27
  • 打赏
  • 举报
回复
up
tserpent 2003-06-26
  • 打赏
  • 举报
回复
可爱--〉 athena521(小猪) ,答非所问,这个我也能做到。

我要的是:SHBrowseForFolder()能扩展到我指定的目录,而不是总是“我的电脑“,但使用pidlRoot,由只能显示一个目录。
不知道vc的目录对话框怎么做的?
athena521 2003-06-26
  • 打赏
  • 举报
回复
LPMALLOC pMalloc;
BROWSEINFO bi;
if (SUCCEEDED(SHGetMalloc(&pMalloc)))
{
ZeroMemory(&bi,sizeof(bi));
char pszDirName[MAX_PATH];
LPITEMIDLIST pidl;
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = pszDirName;
bi.lpszTitle = _T("??要批量??文件所在的目?");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if ((pidl = ::SHBrowseForFolder(&bi)) != NULL)
{
if(::SHGetPathFromIDList(pidl, pszDirName))
{
SetCurrentDirectory(pszDirName);
CFileFind findch1;
CString strconv;
CString strsour;
if(findch1.FindFile("*.tif"))
{
CFile SourceFile;
CStdioFile TargetFile;
BOOL bfindresult;
do
{
bfindresult= findch1.FindNextFile();
strsour=findch1.GetFilePath();
strconv=strsour;
strconv.MakeLower();
}while(bfindresult);
MessageBox("??完?!","??完?!",MB_OK);
}
else
{
MessageBox("没找到CH1文件","没找到",MB_OK);
}
findch1.Close();
}
pMalloc->Free(pidl);
}
pMalloc->Release();
}
tserpent 2003-06-26
  • 打赏
  • 举报
回复
up

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧