用CFileDialog是不能实现的, 试用下面的代码.
#include <shlobj.h> CString strFilePath;
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("Ñ¡Ôñ²¥³ö±í·¾¶");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL)
{
if(SHGetPathFromIDList(pidl, pszBuffer))
{
CString strTemp(pszBuffer); strFilePath = strTemp;
if (strFilePath.GetLength() <= 1)
{
}
else if (strFilePath.Right(1) != _T("\\"))
strFilePath += _T("\\");
}
}
GetDlgItem(IDC_STATIC_PATH)->SetWindowText(strFilePath);
sad_pacific
#include <shlobj.h> CString strFilePath;
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T("Ñ¡Ôñ²¥³ö±í·¾¶");
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL)
{
if(SHGetPathFromIDList(pidl, pszBuffer))
{
CString strTemp(pszBuffer); strFilePath = strTemp;
if (strFilePath.GetLength() <= 1)
{
}
else if (strFilePath.Right(1) != _T("\\"))
strFilePath += _T("\\");
}
}
GetDlgItem(IDC_STATIC_PATH)->SetWindowText(strFilePath);
sad_pacific
解决方案 »
- ocx 打包成CAB文件时版本填写
- 我用webbrowser控件打开一个网页,然后,网页需要输入用户名密码,我想不用输入就可以登录,有什么方法可以实现这个效果
- 我再ATL建立的工程大量有mfc的CString ,CArray,但后来确发生了很多问题,请问是不是CString ,CArray引起的问题呢?
- VC调整控件大小问题?
- CTreeCtrl中图片没有显示出来,为什么,在线等,谢谢
- 急问DirectX9的C++文档的确切作者(开发者)是谁?(12小时之内结贴)
- 求一个ATL做的 NT service 源程序,结构清晰,有些关于这类型程序的注解。100分相送。
- ***ADO的反复连接出现“未指定错误”是什么原因?***
- 栈溢出
- 一个棘手的打印问题
- 在OpenGL中怎么定义超过8个的光源?求教OpenGL高手。
- 怎样用自己的程序代替windows cd player?
如何改变这个对话框的大小及标题?
多谢!
此对话框无法改变大小, 但可改变标题.
bi.lpszTitle = _T("我的标题");
...
(另, 以上只是我个人所知, 不表示一定是那样)
sad Pacific