CFileDialog 사용 OFNALLOWMULTISELECT 로고 여러 파일 선택

   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;

좋은 웹페이지 즐겨찾기