CFileDialog newDlg(TRUE,"*.dat","",OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,
        "(*.dat)|*.dat|所有文件 (*.*)|*.*||",NULL );
// CString strTemp,FileName;
if(newDlg.DoModal()==IDOK)
{
        char* szBuf = new char[1000*256];
newDlg.m_ofn.lpstrFile = szBuf;
newDlg.m_ofn.nMaxFile  = 1000*256 - 8;
pos = newDlg.GetStartPosition();
// File_Name=newDlg.GetFileTitle();

int n=0,m;
 while(pos)
{
strPath[n] = newDlg.GetNextPathName(pos);
filenum++;
n++;
}最多可以选择十几个文件,多了就不行了

解决方案 »

  1.   

    CFileDialog newDlg(TRUE,"*.dat","",OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,
            "(*.dat)|*.dat|所有文件 (*.*)|*.*||",NULL );
            char* szBuf = new char[1000*256];
    memset(szBuf,0,1000*256);
    newDlg.m_ofn.lpstrFile = szBuf;
    newDlg.m_ofn.nMaxFile  = 1000*256 - 8;
    // CString strTemp,FileName;
    if(newDlg.DoModal()==IDOK)
    {
    POSITION pos = newDlg.GetStartPosition();
    // File_Name=newDlg.GetFileTitle();

    int n=0,m;
     while(pos)
    {
    CString s = newDlg.GetNextPathName(pos);
    // filenum++;
    n++;
    }
    }
      

  2.   

    memset(szBuf,0,1000*256);
    newDlg.m_ofn.lpstrFile = szBuf;
    newDlg.m_ofn.nMaxFile  = 1000*256 - 8;
    这段是什么意思?多谢啦