那位大哥帮忙转成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不用_T宏?你这段代码肯定还有个接口声明,一并转了,要不转了也用不了,其他没什么,CFileDialog在d中有个控件,CString直接转d中的string,如果那个接口是unicode编码的话就转widestring,CString.Format()变string:=Format(),AfxMessageBox变MessageBox,NULL变0。
      

  2.   

    要转思想不要转代码看懂过程用delphi重写一遍
      

  3.   

    lovezypj兄啊,有那水平,就不会来这请大家帮助了。