把音频文件放在工程当前目录下,下面代码便可实现音频播放。
#include "stdafx.h"
#include <windows.h>
#include <mmsystem.h>
#include <conio.h>
#pragma comment(lib,"winmm.lib")
int main(int argc, char* argv[])
{
PlaySound("019.wav", NULL,!SND_SYNC|SND_LOOP );
getch();
return 0;
}
本文介绍了一个简单的C++程序,该程序使用Windows API的PlaySound函数来播放位于工程当前目录下的音频文件019.wav,并使其循环播放直到用户按下任意键。
6236

被折叠的 条评论
为什么被折叠?



