你的MAX_CLASS_FILE ==12吗?

解决方案 »

  1.   

    你的MAX_CLASS_FILE ==12吗?
      

  2.   

    不好意思,没注意看你的问题。
    ccnuxjg(暗黑执政官)说的有道理,你的MAX_CLASS_FILE是等于12吗?
    注意你这小段代码:
    if(MAX_CLASS_FILE<=nFileNameListIndex)
        break;
    循环结束条件应该是:
    if(0==pos)    break;
      

  3.   

    MAX_CLASS_FILE=256
    这是我自己设的,与Windows无关
      

  4.   

    http://codeguru.earthweb.com/dialog/MultiFileSelect.shtml
      

  5.   

    http://www.csdn.net/expert/topic/624/624448.xml?temp=5.212039E-02
      

  6.   

    在使用dlg.GetNextPathName(pos)之前,最好用getstartposition();
    另外你要自己提供足够的缓冲区来接受返回的多个文件,这通过用自己申请内存的指针来替换m_ofn.lpstrfile.
      

  7.   

    要开大一点的缓冲区,请看MSDN:To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.
      

  8.   

    加上以下东东,就可以打开100个文件
    dlg.m_ofn.nMaxFile = 100 * MAX_PATH;
    dlg.m_ofn.lpstrFile = new TCHAR[dlg.m_ofn.nMaxFile];
    ZeroMemory(dlg.m_ofn.lpstrFile, sizeof(TCHAR) * dlg.m_ofn.nMaxFile);