GetDlgItem(IDC_FILENAME)->GetWindowText(csT1_);
ZeroMemory(&m_stmmIF,sizeof(MMIOINFO));
DeleteFile((PCHAR)(LPCTSTR)csT1_);
m_hOPFile=mmioOpen((PCHAR)(LPCTSTR)csT1_,&m_stmmIF,MMIO_WRITE | MMIO_CREATE);
if(m_hOPFile==NULL)
throw "Can not open file...";
ZeroMemory(&m_stckOutRIFF,sizeof(MMCKINFO));
m_stckOutRIFF.fccType = mmioFOURCC('W', 'A', 'V', 'E');
mRes=mmioCreateChunk(m_hOPFile, &m_stckOutRIFF, MMIO_CREATERIFF);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
throw m_csErrorText;
}
ZeroMemory(&m_stckOut,sizeof(MMCKINFO));
m_stckOut.ckid = mmioFOURCC('f', 'm', 't', ' ');
m_stckOut.cksize = sizeof(m_stWFEX);
mRes=mmioCreateChunk(m_hOPFile, &m_stckOut, 0);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
throw m_csErrorText;
}
nT1=mmioWrite(m_hOPFile, (HPSTR) &m_stWFEX, sizeof(m_stWFEX));
if(nT1!=sizeof(m_stWFEX))
{
m_csErrorText.Format("Can not write Wave Header..File: %s ,Line Number:%d",__FILE__,__LINE__);
throw m_csErrorText;
}
mRes=mmioAscend(m_hOPFile, &m_stckOut, 0);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
throw m_csErrorText;
}
m_stckOut.ckid = mmioFOURCC('d', 'a', 't', 'a');
mRes=mmioCreateChunk(m_hOPFile, &m_stckOut, 0);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
throw m_csErrorText;
}
...
mmioWrite(m_hOPFile,pHdr->lpData,pHdr->dwBytesRecorded);
...
if(m_hOPFile)
{
mRes=mmioAscend(m_hOPFile, &m_stckOut, 0);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
}
mRes=mmioAscend(m_hOPFile, &m_stckOutRIFF, 0);
if(mRes!=MMSYSERR_NOERROR)
{
StoreError(mRes,FALSE,"File: %s ,Line Number:%d",__FILE__,__LINE__);
}
mmioClose(m_hOPFile,0);
m_hOPFile=NULL;
}