void CMy66Dlg::OnButton4()
{
#define MAX_CFileDialog_FILE_COUNT 99
#define FILE_LIST_BUFFER_SIZE ((MAX_CFileDialog_FILE_COUNT * (MAX_PATH + 1)) + 1)
CString fileName;
char* p = fileName.GetBuffer( FILE_LIST_BUFFER_SIZE );
CFileDialog dlgFile(TRUE);
OPENFILENAME& ofn = dlgFile.m_ofn;//.GetOFN()
ofn.Flags |= OFN_ALLOWMULTISELECT;
ofn.lpstrFile = p;
ofn.nMaxFile = FILE_LIST_BUFFER_SIZE;
POSITION pos = NULL;
CString posPaht;
if(dlgFile.DoModal()==IDOK){
fileName.ReleaseBuffer();
for(pos=dlgFile.GetStartPosition();pos!=NULL;){
CString str = dlgFile.GetNextPathName(pos);
MessageBox(str, _T("提示"));
}
}
}
{
#define MAX_CFileDialog_FILE_COUNT 99
#define FILE_LIST_BUFFER_SIZE ((MAX_CFileDialog_FILE_COUNT * (MAX_PATH + 1)) + 1)
CString fileName;
char* p = fileName.GetBuffer( FILE_LIST_BUFFER_SIZE );
CFileDialog dlgFile(TRUE);
OPENFILENAME& ofn = dlgFile.m_ofn;//.GetOFN()
ofn.Flags |= OFN_ALLOWMULTISELECT;
ofn.lpstrFile = p;
ofn.nMaxFile = FILE_LIST_BUFFER_SIZE;
POSITION pos = NULL;
CString posPaht;
if(dlgFile.DoModal()==IDOK){
fileName.ReleaseBuffer();
for(pos=dlgFile.GetStartPosition();pos!=NULL;){
CString str = dlgFile.GetNextPathName(pos);
MessageBox(str, _T("提示"));
}
}
}
来源:CSDN
作者:宇宙379
链接:https://blog.csdn.net/a379039233/article/details/39013401