![]() |
#2
rjsp2018-07-18 12:40
|
已经确认了错误代码:
mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&mciOpen);
异常是0x00007FFC3676CD15 (winmm.dll) (Valiant_game5.exe 中)处有未经处理的异常: 0xC0000005: 读取位置 0x000000009ABCF79C 时发生访问冲突。 出现了
以下是整个函数的代码

UINT DeviceID;
void Music(WCHAR* a)
{
char str[128] = { 0 };
int i = 0;
char buf[128] = { 0 };
MCI_OPEN_PARMS mciOpen;
MCIERROR mciError;
mciOpen.lpstrDeviceType = _T("mpegvideo");
mciOpen.lpstrElementName = a;
mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&mciOpen);
if (mciError)
{
return;
}
DeviceID = mciOpen.wDeviceID;
MCI_PLAY_PARMS mciPlay;
mciError = mciSendCommand(DeviceID, MCI_PLAY, 0, (DWORD)&mciPlay);
if (mciError)
{
return;
}
return;
}
void Music(WCHAR* a)
{
char str[128] = { 0 };
int i = 0;
char buf[128] = { 0 };
MCI_OPEN_PARMS mciOpen;
MCIERROR mciError;
mciOpen.lpstrDeviceType = _T("mpegvideo");
mciOpen.lpstrElementName = a;
mciError = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)&mciOpen);
if (mciError)
{
return;
}
DeviceID = mciOpen.wDeviceID;
MCI_PLAY_PARMS mciPlay;
mciError = mciSendCommand(DeviceID, MCI_PLAY, 0, (DWORD)&mciPlay);
if (mciError)
{
return;
}
return;
}
求助一下,不过如果有其他方法播放MP3音乐也可以