谁帮我把这段VC代码转成DELPHI的,谢谢了!
HMMIO  m_hmmio;  
  MMCKINFO  m_MMCkInfoParent;  
  WAVEFORMATEX  m_PCMWaveFmtRecord;  
  MMCKINFO  m_MMCkInfoChild;  
    
    
        TCHAR  bigBuff[2048]  =  "";    //  maximum  common  dialog  buffer  size  
        TCHAR  szFilter[]  =  
              "Text  Files  (*.wav)|*.wav|All  Files  (*.*)|*.*||";  
        //TCHAR  csFileName[MAX_PATH];  
        //CString  csFileName;  
        CString  m_strFilePath;  
    
        CString  strWaveInformation;  
        CString  szExtFile;  
    
        CFileDialog  dlg(TRUE,  NULL,  NULL,  
              OFN_HIDEREADONLY  |  OFN_ALLOWMULTISELECT,  szFilter);  
    
    
        //  Modify  OPENFILENAME  members  directly  to  point  to  bigBuff  
        dlg.m_ofn.lpstrFile  =  bigBuff;  
        dlg.m_ofn.nMaxFile  =  sizeof(bigBuff);  
    
        if(dlg.DoModal()  ==  IDOK)  
        {  
        m_strFilePath  =  dlg.GetPathName();  
        }  
        else  
        return;  
    
  m_hmmio  =  mmioOpen((LPSTR)(LPCTSTR)m_strFilePath,NULL,MMIO_READ);  
  if(!m_hmmio)  
  {  
  AfxMessageBox("unable  to  open  Sound  MM  File");  
  return  ;  
  }  
  m_MMCkInfoParent.fccType  =  mmioFOURCC('W','A','V','E');  
  int  errorCode  =  mmioDescend(m_hmmio,  &m_MMCkInfoParent,NULL,MMIO_FINDRIFF);  
  if(errorCode)  
  {  
  AfxMessageBox("Error  descending  into  file");  
  mmioClose(m_hmmio,0);  
  m_hmmio  =  NULL;  
  return  ;  
  }  
  m_MMCkInfoChild.ckid  =  mmioFOURCC('f','m','t','  ');  
  errorCode  =  mmioDescend(m_hmmio,&m_MMCkInfoChild,&m_MMCkInfoParent,MMIO_FINDCHUNK);  
  if(errorCode)  
  {  
  AfxMessageBox("Error  descending  in  file");  
  mmioClose(m_hmmio,0);  
  m_hmmio  =  NULL;  
  return  ;  
  }  
  DWORD  bytesRead  =  mmioRead(m_hmmio,(LPSTR)&m_PCMWaveFmtRecord,m_MMCkInfoChild.cksize);  
  if(bytesRead  <  0)  
  {  
  AfxMessageBox("Error  reading  PCM  wave  format  record");  
  mmioClose(m_hmmio,0);  
  return  ;  
  }  
  strWaveInformation.Format("wFormatTag  =  %d  ,  nChannels  =  %d,  nSamplesPerSec  =  %d,  nAvgBytesPerSec  =  %d,  nBlockAlign  =  %d,  wBitsPerSample  =  %d,  cbSize  =  %d",  
                    m_PCMWaveFmtRecord.wFormatTag,  m_PCMWaveFmtRecord.nChannels,  
    m_PCMWaveFmtRecord.nSamplesPerSec  ,m_PCMWaveFmtRecord.nAvgBytesPerSec  ,  
    m_PCMWaveFmtRecord.nBlockAlign,  m_PCMWaveFmtRecord.wBitsPerSample,m_PCMWaveFmtRecord.cbSize);  
  AfxMessageBox(strWaveInformation);  
    
  mmioClose(m_hmmio,0);

解决方案 »

  1.   

            TCHAR  bigBuff[2048]  =  "";    //  maximum  common  dialog  buffer  size  
            TCHAR  szFilter[]  =  
                  "Text  Files  (*.wav)|*.wav|All  Files  (*.*)|*.*||";  
            //TCHAR  csFileName[MAX_PATH];  
            //CString  csFileName;  
            CString  m_strFilePath;  
        
            CString  strWaveInformation;  
            CString  szExtFile;  
        
            CFileDialog  dlg(TRUE,  NULL,  NULL,  
                  OFN_HIDEREADONLY  |  OFN_ALLOWMULTISELECT,  szFilter);  
        
        
            //  Modify  OPENFILENAME  members  directly  to  point  to  bigBuff  
            dlg.m_ofn.lpstrFile  =  bigBuff;  
            dlg.m_ofn.nMaxFile  =  sizeof(bigBuff);  
        
            if(dlg.DoModal()  ==  IDOK)  
            {  
            m_strFilePath  =  dlg.GetPathName();  
            }  
            else  
            return;  
        
    这段是打开文件那个对话框
    直接用GetOpenFileName一个API就能搞定
      

  2.   

    谢谢akirya ! 还有下面的那些,那位老大帮一下!
      

  3.   

    uses
      MMSYSTEM,Dialogs;
    var
      m_hmmio:HMMIO;
      m_MMCkInfoParent:MMCKINFO  ;
      m_PCMWaveFmtRecord:WAVEFORMATEX  ;
      m_MMCkInfoChild:MMCKINFO  ;
    //        TCHAR  bigBuff[2048]  =  "";    //  maximum  common  dialog  buffer  size
    //        TCHAR  szFilter[]  =
    //              "Text  Files  (*.wav)|*.wav|All  Files  (*.*)|*.*||";  OpenDlg: TOpenDialog;
      OpenDlg_Options: TOpenOptions;
      m_strFilePath:String  ;  strWaveInformation:String ;
      szExtFile:      String  ;  errorCode: Integer;
      bytesRead: LongWord;
    begin
      OpenDlg := TOpenDialog.Create(Nil);
      OpenDlg_Options := OpenDlg.Options;
      Include( OpenDlg_Options,ofHideReadOnly);
      //Include(OpenDlg_Options,ofAllowMultiSelect); //多文件需要特别处理
      OpenDlg.Options := OpenDlg_Options;
      OpenDlg.Filter := 'Text  Files  (*.wav)|*.wav|All  Files  (*.*)|*.*||';    
      if(OpenDlg.Execute() ) then
        m_strFilePath  :=  OpenDlg.FileName //OpenDlg.Files.Text //在选择多文件的时候这里可能需要注意一下文件名之间的分隔符
      else
        Exit;
        
      m_hmmio  :=  mmioOpen(PChar(m_strFilePath),NIL,MMIO_READ);
      if(m_hmmio=0) then
      begin
        showMessage('unable  to  open  Sound  MM  File');
        Exit;
      end;  m_MMCkInfoParent.fccType  :=  mmioStringToFOURCC('WAVE',MMIO_TOUPPER);//mmioFOURCC('W','A','V','E');
      errorCode  :=  mmioDescend(m_hmmio,  @m_MMCkInfoParent,Nil,MMIO_FINDRIFF);
      if(errorCode<>0) then
      begin
        ShowMessage('Error  descending  into  file');
        mmioClose(m_hmmio,0);
        m_hmmio  :=  0;
        Exit  ;
      end;  m_MMCkInfoChild.ckid  :=  mmioStringToFOURCC('fmt  ',0);//mmioFOURCC('f','m','t','  ');
      errorCode  :=  mmioDescend(m_hmmio,@m_MMCkInfoChild,@m_MMCkInfoParent,MMIO_FINDCHUNK);
      if(errorCode<>0) then
      begin
        ShowMessage('Error  descending  in  file');
        mmioClose(m_hmmio,0);
        m_hmmio  :=  0;
        Exit  ;
      end;  bytesRead  :=  mmioRead(m_hmmio,PChar(@m_PCMWaveFmtRecord),m_MMCkInfoChild.cksize);
      if(bytesRead  <  0) then
      begin
        ShowMessage('Error  reading  PCM  wave  format  record');
        mmioClose(m_hmmio,0);
        Exit;
      end;  strWaveInformation := Format('wFormatTag  =  %d  ,  nChannels  =  %d,  nSamplesPerSec  =  %d,  nAvgBytesPerSec  =  %d,  nBlockAlign  =  %d,  wBitsPerSample  =  %d,  cbSize  =  %d',
                        [m_PCMWaveFmtRecord.wFormatTag,  m_PCMWaveFmtRecord.nChannels,
        m_PCMWaveFmtRecord.nSamplesPerSec  ,m_PCMWaveFmtRecord.nAvgBytesPerSec  ,  
        m_PCMWaveFmtRecord.nBlockAlign,  m_PCMWaveFmtRecord.wBitsPerSample,m_PCMWaveFmtRecord.cbSize]);
      ShowMessage(strWaveInformation);
        
      mmioClose(m_hmmio,0);
    end;
      

  4.   

    如果缺少WAVEFORMATEX
    type
      WAVEFORMATEX = tWAVEFORMATEX;