MP3 playing using mci send string c++

有些话、适合烂在心里 提交于 2019-12-06 08:45:58

After much trial and error, I finally found out a way to make it work. To those who are facing the same problem as me, here it goes:

//if you are using unicode
LPCWSTR a = L"open cannon.mp3 type mpegvideo";
int error = 99;
error = mciSendString(a, NULL,0,0);
int error2;
LPCWSTR b = L"play cannon.mp3";
error2 = mciSendString(b, NULL, 0, 0);

//cannon.mp3 is stored in my resource file
//error is just for debugging

//if you are using multibyte

LPCSTR a = "open cannon.mp3 type mpegvideo";
mciSendString(a, NULL, 0,0);
LPCSTR b = "play cannon.mp3 repeat";
int error2 = mciSendString(b, NULL, 0, 0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!