龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC:大型WAV文件的播放(4)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
//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,

//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);
   }
  }

精彩图集

赞助商链接