#include #include #pragma comment(lib, "C:\\borland\\bcc55\\Lib\PSDK\\winmm.lib") #include void SoundWAVPlay(void) { int i; // 再生 PlaySound(TEXT("xmas004.wav"), 0, SND_LOOP | SND_ASYNC); // サウンド再生中も以降の処理を実行する for (i = 1; i <= 25; i++) { Sleep(1000); printf("%d秒経過\n", i); // 20秒経過後に再生をストップする if (i == 20) { // ストップ PlaySound(NULL, 0, SND_PURGE); printf("再生停止\n"); } } } int main(void) { SoundWAVPlay(); return 0; }