VC中选择目录对话框
2008-11-14 10:21
435 查看
void SelectDirDlg(char Dir[])
{
BROWSEINFO bi;
ITEMIDLIST *pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = Dir;
bi.lpszTitle = "选择一个目录";
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
pidl = SHBrowseForFolder( &bi ); /* Display "Select Folde
r" dialog box, Get the
folder name and co
nvert it into a ITEMLIST data structure. */
if ( pidl == NULL )
Dir[0] = 0;
if (!SHGetPathFromIDList( pidl, Dir )) /* Retrieve folder name from ITEMLIST structure. */
Dir[0] = 0;
}
void CRestoreTZDlg::OnButtonBrowseSrc()
{
// TODO: Add your control notification handler code here
char dir[256]="";
SelectDirDlg(dir);
//CString sSrcDir(dir);
this->m_sSrcDir.Format("%s",dir);
UpdateData(FALSE);
}
{
BROWSEINFO bi;
ITEMIDLIST *pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = Dir;
bi.lpszTitle = "选择一个目录";
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
pidl = SHBrowseForFolder( &bi ); /* Display "Select Folde
r" dialog box, Get the
folder name and co
nvert it into a ITEMLIST data structure. */
if ( pidl == NULL )
Dir[0] = 0;
if (!SHGetPathFromIDList( pidl, Dir )) /* Retrieve folder name from ITEMLIST structure. */
Dir[0] = 0;
}
void CRestoreTZDlg::OnButtonBrowseSrc()
{
// TODO: Add your control notification handler code here
char dir[256]="";
SelectDirDlg(dir);
//CString sSrcDir(dir);
this->m_sSrcDir.Format("%s",dir);
UpdateData(FALSE);
}
相关文章推荐
- VC++, MFC中实现选择文件夹,选择文件对话框,确定当前工作目录(转载)
- VC++选择目录对话框
- VC中选择目录对话框
- vc创建选择目录对话框以及遍历目录下所有文件
- VC打开一个目录选择对话框,并设置初始化目录
- VC打开一个目录选择对话框,并设置初始化目录
- (转)记录:VC++中打开保存目录选择对话框操作
- VC++实现文件选择对话框 及目录
- VC++中打开保存目录选择对话框操作
- VC++ 目录选择对话框
- VC中目录选择对话框的使用
- VC实现在浏览目录对话框中选择目录
- VC++中的目录选择对话框
- VC中选择文件目录和打开文件对话框
- 记录:VC++中打开保存目录选择对话框操作
- (转)记录:VC++中打开保存目录选择对话框操作
- VC文件目录选择对话框(任意目录)
- 使用vc打开目录选择对话框
- VC 文件对话框 目录选择
- MFC选择目录对话框和选择文件对话框