C++程序运行错误
本来程序运行的很好,我用windows media player 播放了一下mid文件再运行的时候就播放不了了,有高手指点一下!/*播放声音*/
if(OpenParms1.wDeviceID)
mciSendCommand(OpenParms1.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)&OpenParms1);
if(OpenParms2.wDeviceID)
mciSendCommand(OpenParms2.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)&OpenParms2);
//打开
//MCI_OPEN_PARMS OpenParms;
OpenParms1.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_WAVEFORM_AUDIO;//MIDI设备类型
OpenParms1.lpstrElementName = (LPCSTR)"res\\start.wav";//文件名
OpenParms1.wDeviceID = 0;//设备标识号(用于和其他设备区分)
mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_ELEMENT|MCI_NOTIFY, (DWORD)&OpenParms1);
//播放
MCI_PLAY_PARMS PlayParms;
PlayParms.dwFrom = 0;//从头开始播放
mciSendCommand(OpenParms1.wDeviceID, MCI_PLAY, MCI_FROM, (DWORD)&PlayParms);
OpenParms2.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_SEQUENCER;//WAV设备类型
OpenParms2.lpstrElementName = (LPCSTR)"res\\bg.mid";//文件名
OpenParms2.wDeviceID = 0;//设备标识号(用于和其他设备区分)
mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_ELEMENT|MCI_NOTIFY, (DWORD)&OpenParms2);
//播放
PlayParms.dwFrom = 0;//从头开始播放
mciSendCommand(OpenParms2.wDeviceID, MCI_PLAY, MCI_FROM, (DWORD)&PlayParms)