CFileDialog 使用 OFN_ALLOWMULTISELECT 标志选择多个文件
2010-09-01 07:19
471 查看
CFileDialog dlg( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, NULL, NULL );
DWORD MAXFILE = 2562; //2562 is the max
TCHAR* pc = new TCHAR[MAXFILE * (MAX_PATH+1) + 1];
pc[0] = pc[1] = 0;
dlg.m_ofn.nMaxFile = MAXFILE;
dlg.m_ofn.lpstrFile = pc;
int iReturn = dlg.DoModal();
if(iReturn == IDOK)
{
int nCount = 0;
POSITION pos = dlg.GetStartPosition();
while (pos != NULL)
{
CString szPathName = dlg.GetNextPathName(pos);
TRACE( _T("%s/n"), szPathName);
nCount++;
}
CString str;
str.Format("Successfully opened %d files/n", nCount);
AfxMessageBox(str);
}
else if(iReturn == IDCANCEL)
AfxMessageBox("Cancel");
delete []pc;
DWORD MAXFILE = 2562; //2562 is the max
TCHAR* pc = new TCHAR[MAXFILE * (MAX_PATH+1) + 1];
pc[0] = pc[1] = 0;
dlg.m_ofn.nMaxFile = MAXFILE;
dlg.m_ofn.lpstrFile = pc;
int iReturn = dlg.DoModal();
if(iReturn == IDOK)
{
int nCount = 0;
POSITION pos = dlg.GetStartPosition();
while (pos != NULL)
{
CString szPathName = dlg.GetNextPathName(pos);
TRACE( _T("%s/n"), szPathName);
nCount++;
}
CString str;
str.Format("Successfully opened %d files/n", nCount);
AfxMessageBox(str);
}
else if(iReturn == IDCANCEL)
AfxMessageBox("Cancel");
delete []pc;
相关文章推荐
- CFileDialog 使用 OFN_ALLOWMULTISELECT 标志选择多个文件
- 文件选择对话框的使用(CFileDialog)
- CFileDialog文件选择对话框的使用与定义
- CFileDialog文件选择对话框的使用
- bootstrap multiselect插件级联选择框操作 内容从json文件获取
- 使用CFileDialog 同时选择多个文件或文件夹
- CFileDialog文件选择对话框的使用
- 使用CFileDialog 同时选择多个文件或文件夹
- MFC文件选择对话框CFileDialog的使用
- CFileDialog文件选择对话框使用说明
- 使用CFileDialog选择多个文件
- [转载] 使用CFileDialog选择多个文件
- 使用CFileDialog选择多个文件(VC)
- CFileDialog文件选择对话框的使用
- MFC中使用CFileDialog可以批量选择文件的方法
- VS2010 使用 CFileDialog 选择文件
- XML:使用DOM技术解析xML文件中的城市,实现select级联选择
- CFileDialog文件选择对话框的使用
- 使用MFC的CFileDialog实现选择多个文件
- 第20篇:基于bootstrap-datatimepicker带时间段的选择 (与multiselect搭配使用,与angular搭配使用)