用CFileDialg打开文件的时候。
如果是多选方式,当选择的文件很多的时候dlgFile.DoModal()返回值不等于IDOK。
该怎么办?

解决方案 »

  1.   

    CFileDialog::DoModal 
    virtual int DoModal( );Return ValueIDOK or IDCANCEL. If IDCANCEL is returned, call the WindowsCommDlgExtendedError function to determine whether an error occurred.IDOK and IDCANCEL are constants that indicate whether the user selected the OK or Cancel button.那还能返回什么啊??
      

  2.   

    这怎么可能呢?除非你的domodal()执行错误。
      

  3.   

    我是说当适用文件对话框选择文件的时候,
    如果同时选择的文件数量很多,(比如100个)的时候返回结果不等于IDOK.
    而当同时选择的文件数量少的时候,(比如10个)的时候返回结果等于IDOK.
    你没注意到这个问题吗?
      

  4.   

    问题已经解决:
    char FileName[6400];
    memset(FileName, 0, sizeof(FileName));
    dlgFile.m_ofn.lpstrFile = FileName;
    dlgFile.m_ofn.nMaxFile = 6400;
    不过我还想问一下,m_ofn.lpstrFile是存储文件名的buffer,
    m_ofn.nMaxFile是最多可以选择的文件数,他们有什么关系,要是buffer和最大文件数不等就会不好用,为什么?这里都设成6400,如果最大文件数不等于6400,就不好用了(就不能选太多的文件数,否则return 2)