mciError=mciSendCommand(NULL,MCI_OPEN,MCI_OPEN_ELEMENT,(DWORD)(LPVOID)&mciOpen);//打开文件
if(mciError) //出错处理 {
mciGetErrorString(mciError,buf,128); printf("%s\n",buf); getchar(); }
m_wDeviceID=mciOpen.wDeviceID; MCI_PLAY_PARMS mciPlay; mciPlay.dwFrom=0;
mciError=mciSendCommand(m_wDeviceID,MCI_PLAY,MCI_FROM,(DWORD)(LPVOID)&mciPlay);
if(mciError) {
mciGetErrorString(mciError,buf,128); printf("%s\n",buf); getchar(); } }
void mcistop()//音乐停止,关闭MCI设备 {
char buf[128]; MCIERROR mciError; if(m_wDeviceID) {
MCI_GENERIC_PARMS gp; gp.dwCallback=NULL;
mciError=mciSendCommand(m_wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)&gp); m_wDeviceID=NULL;