VC:大型WAV文件的播放(4)
//return result of MCI operation
return dwResult;
}
DWORD CWave::Stop()
{
DWORD dwResult=0;
//close if element is currently open
if(m_nElementID)
{
dwResult=mciSendCommand(m_nElementID,MCI_CLOSE,NULL,NULL);
//display error message if failed
if(dwResult)
DisplayErrorMsg(dwResult);
//set identifier to closed state
else
m_nElementID=0;
}
return dwResult;
}
void CWave::DisplayErrorMsg(DWORD dwError)
{
//check if there was an error
if(dwError)
{
//character string that contains error message
char szErrorMsg[MAXERRORLENGTH];
//retrieve string associated error message
if(!mciGetErrorString(dwError,szErrorMsg,sizeof(szErrorMsg)))
strcpy(szErrorMsg,"Unknown Error");
//display error string in message box
AfxMessageBox(szErrorMsg);
}
}
- 上一篇:没有了
- 下一篇:Visual C++与Delphi/C++Builder之比较(二)

