CFileDialog cfd(true,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ALLOWMULTISELECT,MusicType);我加入了OFN_ALLOWMULTISELECT那么我选了多个文件 cfd里面能得到所有这些文件的路径或者文件名什么的吗?和我只选一个文件有哪些区别呢?谢谢~

解决方案 »

  1.   

    POSITION pos ( fileDlg.GetStartPosition() );while( pos )
    {
      CString csFileName(  fileDlg.GetNextPathName( pos ) );
      //implement ur fn to open the file accordingly
    }
      

  2.   

    在你增加了OFN_ALLOWMULTISELECT标志后,在你选择了多个文件后,你得到的完整的路径是这样的:
    每个文件名都会用‘\0’来分割开来,例如:
    C:\TEXT\\0A.TXT\0B.TXT\0\0
      

  3.   

    CStringArray cstrArr;
    if (fd.DoModal()==IDOK)
    {// invalid file name will be prompted.
     // file existence will be checked
    // may be multi selection under one same directory
    POSITION pos=fd.GetStartPosition( );
    while (pos)
    {
    cstrArr.Add(fd.GetNextPathName(pos));

      

  4.   


    mcisendstring播放我想让它同步 就是一首放完放下一首的那种~
      

  5.   

    参考:LRESULT CTestDlg::OnMciNotify(WPARAM wParam,LPARAM IParam)
    {
    int iSel=-1;
    switch (wParam)
    {
    case MCI_NOTIFY_ABORTED: 
    //The device received a command that prevented the current conditions 
    //for initiating the callback function from being met. 
    //If a new command interrupts the current command and it also requests notification,
    //the device sends this message only and not MCI_NOTIFY_SUPERSEDED. 
    // AfxMessageBox("ABORTED");
    break;
    case MCI_NOTIFY_FAILURE:
    //A device error occurred while the device was executing the command. 
    // AfxMessageBox("FAILED");
    break;
    case MCI_NOTIFY_SUCCESSFUL:
    //The conditions initiating the callback function have been met. 
    //AfxMessageBox("SUCCESSFUL");
    if(m_bLineDown==TRUE) break;// ? skip 
    //
    iSel=m_iSelAll[m_FileCounter];
    if(m_ListCtrl.GetCheck(iSel)==TRUE)
    {
    m_wave.Replay();
    }
    else
    {
    OnStop();
    m_FileCounter++;
    if(m_FileCounter < (int) m_ListCtrl.GetSelectedCount()) 
    {
    OnPlay();
    }
    else
    {
    m_FileCounter=0;
    }
    }
    break;
    case MCI_NOTIFY_SUPERSEDED: 
    //The device received another command with the "notify" flag set and
    //the current conditions for initiating the callback function have been superseded. 
    // AfxMessageBox("SUPERSEDED");
    break;
    }
    return 0;
    }