vc中怎样使用目录选择对话框

bbs008 2006-07-25 09:32:03
在有些程序中,需要选择目标目录而不是标准的打开或保存文件。在vc中怎样调用选择目录对话框呢?
...全文
888 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Stefine 2006-07-25
  • 打赏
  • 举报
回复
去codeproject上找CObjectDisk类
yayafu 2006-07-25
  • 打赏
  • 举报
回复
http://www.vckbase.com/code/listcode.asp?mclsid=15&sclsid=1505,还可以设置初始目录哦
cleverwyq 2006-07-25
  • 打赏
  • 举报
回复
BROWSEINFO bi;
bi.hwndOwner =m_hWnd;
bi.pidlRoot =NULL;
bi.pszDisplayName =pBuf;
bi.lpszTitle =pBuf;
bi.ulFlags =BIF_BROWSEFORCOMPUTER && BIF_RETURNONLYFSDIRS;
bi.lpfn =NULL;
bi.lParam =NULL;

LPITEMIDLIST pidl;
BOOL bSuccess=FALSE;

if(pidl=SHBrowseForFolder(&bi)){
...
}
cleverwyq 2006-07-25
  • 打赏
  • 举报
回复
SHBrowseForFolder Function

--------------------------------------------------------------------------------

Displays a dialog box enabling the user to select a Shell folder.

Syntax

LPITEMIDLIST SHBrowseForFolder( LPBROWSEINFO lpbi
);
Parameters

lpbi
[in, out] Pointer to a BROWSEINFO structure. On entry, this structure conveys information used to display the dialog box. On exit, it receives information concerning the selected folder.
Return Value

Returns a pointer to an item identifier list (PIDL) specifying the location of the selected folder relative to the root of the namespace. If the user chooses the Cancel button in the dialog box, the return value is NULL.
It is possible that the PIDL returned is that of a folder shortcut rather than a folder. For a full discussion of this case, see the Remarks section.

The display name of the object selected is returned in the buffer pointed to by the pszDisplayName member of the BROWSEINFO parameter structure.

15,979

社区成员

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

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