星星博客 »  > 

C++ 使用CFileDialog选择多个文件

void CFileDemoDlg::OnBnClickedButton1()
{
	CFileDialog log(TRUE, "文件", "*.*", OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, "File(*.*)|*.*||", NULL);
	if (log.DoModal()==IDOK)
	{
		POSITION pos = log.GetStartPosition();
		while (pos!=NULL)
		{
			CString fileName = log.GetNextPathName(pos);
			m_list.AddString(fileName);
		}
		
	}
}

 

相关文章