用CFileDialog打开多个文件
作者:互联网
POSITION pos;
CString strFilename;
CFileDialog FileDlg(TRUE,"txt",NULL,OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT, "Text Files(*.txt)|*.txt|All Files(*.*)|*.*|");
FileDlg.m_ofn.nMaxFile = 100 * MAX_PATH; //100 Files
FileDlg.m_ofn.lpstrFile = new TCHAR[FileDlg.m_ofn.nMaxFile];
ZeroMemory(FileDlg.m_ofn.lpstrFile, sizeof(TCHAR) * FileDlg.m_ofn.nMaxFile);
if(FileDlg.DoModal() == IDOK)
{
pos = FileDlg.GetStartPosition();
while(pos)
{
strFilename = FileDlg.GetNextPathName(pos);
AfxMessageBox(strFilename);
}
}
CString strFilename;
CFileDialog FileDlg(TRUE,"txt",NULL,OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ALLOWMULTISELECT, "Text Files(*.txt)|*.txt|All Files(*.*)|*.*|");
FileDlg.m_ofn.nMaxFile = 100 * MAX_PATH; //100 Files
FileDlg.m_ofn.lpstrFile = new TCHAR[FileDlg.m_ofn.nMaxFile];
ZeroMemory(FileDlg.m_ofn.lpstrFile, sizeof(TCHAR) * FileDlg.m_ofn.nMaxFile);
if(FileDlg.DoModal() == IDOK)
{
pos = FileDlg.GetStartPosition();
while(pos)
{
strFilename = FileDlg.GetNextPathName(pos);
AfxMessageBox(strFilename);
}
}
标签:Files,文件,CFileDialog,txt,OFN,ofn,pos,FileDlg,打开 来源: https://blog.csdn.net/eamon100/article/details/89334201