多选择文件打开对话框
关键点
可以打开多个文件
实现过程
CString filter = "文本文档(*.txt)|*.txt|所有文件(*.*)|*.*||";
CFileDialog OpenFileDialog(TRUE, NULL, "*.txt", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT, filter);
// OpenFileDialog.m_ofn.lpstrInitialDir = "D:\\";
// OpenFileDialog.m_ofn.lpstrTitle="Open File";
CString Msg;
if(OpenFileDialog.DoModal() == IDOK)
{
POSITION pos;
pos=OpenFileDialog.GetStartPosition();//开始遍历用户选择文件列表
while (pos!=NULL)
{
CString filename=OpenFileDialog.GetNextPathName(pos);
Msg+=filename+"\r\n";
}
MessageBox(Msg);
}
|
图
备注
相关链接
原文地址:http://www.cnblogs.com/xe2011/p/3734535.html