MFC或API有没有选择目录的标准对话框可用呀?

seaglee 2005-05-17 01:53:22
如果没有,有没有示例代码呢?先谢了。
...全文
45 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
newzk 2005-05-17
  • 打赏
  • 举报
回复
严重同意楼上
Hendy_So 2005-05-17
  • 打赏
  • 举报
回复
SHBrowseForFolder

自己查MSDN或google,baidu等。
xyking361 2005-05-17
  • 打赏
  • 举报
回复
BOOL CTableLook5020Dlg::GetDirectory(CString &Directory, char *strMsg)
{
BROWSEINFO bi;
bi.hwndOwner=this->m_hWnd; //owner of created dialog box
bi.pidlRoot=0; //unused
bi.pszDisplayName=0; //buffer to receive name displayed by folder (not a valid path)
bi.lpszTitle = strMsg; //title is "Browse for Folder", this is an instruction
bi.lpfn = NULL; //callback routine called when dialog has been initialized
bi.lParam=0; //passed to callback routine
bi.ulFlags=
BIF_RETURNONLYFSDIRS | //only allow user to select a directory
BIF_STATUSTEXT | //create status text field we will be writing to in callback
0;
LPITEMIDLIST lpItemId=::SHBrowseForFolder(&bi);
if(lpItemId == NULL)
return FALSE;
if (lpItemId)
{
LPTSTR szBuf=Directory.GetBuffer(MAX_PATH);
::SHGetPathFromIDList(lpItemId, szBuf);
::GlobalFree(lpItemId);
Directory.ReleaseBuffer();
}
return TRUE;
}

15,979

社区成员

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

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