Playing mp3 files with mciSendString (MCIERR_CANNOT_LOAD_DRIVER)

空扰寡人 提交于 2020-01-04 03:41:05

问题


I am trying to write some code that can play an .mp3 file. I thought I could use the mciSendString call, but I am getting a strange error.

So, when I have this code:

int rc=mciSendString(L"open songname.mp3 alias song1", NULL, 0, 0); 

rc returns with the number 266, and the error string returned with GetErrorString was:

"Unknown problem while loading the specified device driver."

Error 266 is MCIERR_CANNOT_LOAD_DRIVER

I have also tried:

int rc=mciSendString(L"open songname.mp3 type mpegvideo alias song1", NULL, 0, 0); 

and received the same error.

I thought it may be the mp3 file, but I tried a few different ones and kept getting the same error.

My code is in C++ and is running on Windows 7. Is my code missing something?


回答1:


Try surrounding songname.mp3 with an extra pair of quotes (be sure to escape them with backslashes).




回答2:


It looks like I didn't have an mp3 codec for MCI. (Actually answered by @LightnessRacesinOrbit in comments to the question.)



来源:https://stackoverflow.com/questions/12984851/playing-mp3-files-with-mcisendstring-mcierr-cannot-load-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!