打开文件对话框与目录选择对话框
来源:互联网 发布:硕普网络日语培训软件 编辑:程序博客网 时间:2024/05/09 07:50
打开文件对话框与目录选择对话框
打开文件对话框
const char pszFilter[] = _T("EXE File (*.txt)|*.txt|All Files (*.*)|*.*||");
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
pszFilter, this);
dlg.m_ofn.lpstrInitialDir = "c://WINDOWS//"; //设置对话框默认呈现的路径
if(dlg.DoModal() == IDOK)
{
CString strFilePath = dlg.GetPathName();
/*如果有多个文件,则
for(POSITION pos = dlg.GetStartPosition(); pos!=NULL; )
{
CString strFilePathName = dlg.GetNextPathName(pos);
*/
}
保存文件对话框
const char pszFilter[] = _T("EXE Files (*.txt)|*.txt||");
CFileDialog dlgSave( FALSE, //FALSE为保存
_T(".txt"), //自动加上的扩展名
_T("Output.txt"), //默认保存的文件名
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
pszFilter, this);
目录选择对话框
BROWSEINFO bi;
char szPathName[MAX_PATH];
char szTitle[] = "选择路径";
ZeroMemory(&bi, sizeof(BROWSEINFO));
bi.hwndOwner = GetSafeHwnd();
bi.pszDisplayName = szPathName;
bi.lpszTitle = szTitle;
bi.ulFlags = 0x0040 ;
CString str;
CString strDir; //选择的目录
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
if(idl == NULL)
{
strDir= "";
return;
}
SHGetPathFromIDList(idl, str.GetBuffer(MAX_PATH * 2));
str.ReleaseBuffer();
if(str != "" && str.GetAt(str.GetLength() - 1) != '//')
str += "//";
strDir = str;
- 打开文件对话框与目录选择对话框
- 打开文件对话框与目录选择对话框
- 打开文件对话框与目录选择对话框
- MFC 选择文件对话框/打开目录对话框
- MFC 选择文件对话框/打开目录对话框
- C#打开选择文件对话框和选择目录对话框
- 打开文件对话框,浏览 等 选择目录
- 目录选择对话框、文件打开或保存对话框、字体对话框和颜色对话框
- 目录选择对话框、文件打开或保存对话框、字体对话框和颜色对话框
- 打开->选择文件对话框
- 打开选择文件对话框
- VC打开文件对话框与保存文件路径选择对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- 选择目录对话框和选择文件对话框
- vs2010MFC选择文件对话框,选择目录对话框
- 选择目录对话框,选择文件对话框
- 哭问娘在何方(3)
- 排序算法小结
- flex amf socket连接例子
- 如何编写异常安全的C++代码
- 单引号与双引号的用法
- 打开文件对话框与目录选择对话框
- Net如何继承IDisposable接口,实现自己的Dispose()函数
- 天上有一朵云(摘录自郑渊洁)
- Visual Studio Debugger Just-In-Time Debugging
- svm软件
- How to Animate Themes
- TypeError: __init__() got an unexpected keyword argument ‘maxlength’
- 我的广告~~~~村民自治的一种方式
- 能帮你找到网页设计灵感的16个网站