采纳率:47%等级:11
已帮助:16342人
1:功能差劲的Playsound函数
事例代码如下
#include
#include
#pragma comment(lib,"WinMM.Lib")
void main()
{
PlaySound("c:\\dui12.wav",NULL,SND_FILENAME|SND_ASYNC);
}
2:功能和Playsound函数一样差劲的函数undplaysound
#include
#include
#pragma comment(lib,"WinMM.Lib")
void main()
{
undPlaySound("c:\\dui12.wav",NULL,SND_FILENAME|SND_ASYNC);
}
3:功能强大的函数,支持混音的MCI类
事例代码如下
#include
#include "mmsystem.h"//导入声音头文件
#pragma comment(lib,"winmm.lib")//导入声音头文件库
#include
void PlayMp3() ;
void main()
{
PlayMp3() ;
PlaySound("C:\\Normal2.wav", NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
system("pause");
}
void PlayMp3()
{
char buf[128];
char str[128] = {0 };
int i = 0;
//use mciSendCommand
MCI_OPEN_PARMS mciOpen;
MCIERROR mciError;
//SetWindowText(NULL,"12345");
mciOpen.lpstrDeviceType = "mpegvideo";
mciOpen.lpstrElementName = "c:\\WELCOME.WAV";
mciError = mciSendCommand(0,MCI_OPEN,