为什么CFileDialog 不能打开多个文件?
可以同时打二十多个文件但不能多了,否则点“打开”反回的也不是IDOK,为什么,
问题是在m_ofn吧,可么做呢?

解决方案 »

  1.   

    typedef struct tagOFN { // ofn 
        DWORD         lStructSize; 
        HWND          hwndOwner; 
        HINSTANCE     hInstance; 
        LPCTSTR       lpstrFilter; 
        LPTSTR        lpstrCustomFilter; 
        DWORD         nMaxCustFilter; //
        DWORD         nFilterIndex; 
        LPTSTR        lpstrFile; 
        DWORD         nMaxFile; 
        LPTSTR        lpstrFileTitle; 
        DWORD         nMaxFileTitle; 
        LPCTSTR       lpstrInitialDir; 
        LPCTSTR       lpstrTitle; 
        DWORD         Flags; 
        WORD          nFileOffset; 
        WORD          nFileExtension; 
        LPCTSTR       lpstrDefExt; 
        DWORD         lCustData; 
        LPOFNHOOKPROC lpfnHook; 
        LPCTSTR       lpTemplateName; 
    } OPENFILENAME; 
    可能与下面的成员有关吧:
     
      DWORD         nMaxCustFilter; //
        DWORD         nMaxFile; 
        DWORD         nMaxFileTitle; 
      

  2.   

    char buf[100000];
    memset(buf,NULL,100000); CFileDialog FileDlg(TRUE,"*.exe",NULL,OFN_ALLOWMULTISELECT,
    "All files (*.*)|*.*||");
    FileDlg.m_ofn.nMaxFile=100000; 
    FileDlg.m_ofn.lpstrFile=buf; if(FileDlg.DoModal()==IDOK)
    {
    POSITION pos=FileDlg.GetStartPosition();
    while(pos)
    {
    MessageBox(FileDlg.GetNextPathName(pos));
    }
    }上面是笨方法!
      

  3.   

    http://www.codeproject.com/dialog/PJA_MultiSelect.asp上面是聪明的方法:)