CFileDialog 使用 OFN_ALLOWMULTISELECT 标志选择多个文件

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;

你可能感兴趣的:(null,delete,Path)