播放声音 Beep和MessageBeep函数(c++) (windows)

 

一:BOOL WINAPI MessageBeep (_in UINT uType );

  播放一个波形文件 (也就是wac格式),每个声音类型的波形声音在注册表中有一个条目 (entry ) 指定

   如MB_OK

 

二:BOOL WINAPI BEEP ( 

  _in DWORD dwFreq, //频率

  _in DWORD dwDuration //毫秒

  );

播放声音 Beep和MessageBeep函数(c++) (windows)_第1张图片

 

G 调:G A B C D E #F G

C 调:C D E F G A B

E 调:E #F #G A B #C #D

 

 
#include 
#include 
#define TIME 1000
 
int main () 
{
	printf("        起来!不愿做奴隶的人们!\n\
	把我们的血肉筑成我们新的长城!\n\
	中华民族到了最危险的时候,\n\
	每个人被迫着发出最后的吼声。\n\
	起来!起来!起来!\n\
	我们万众一心,\n\
	冒着敌人的炮火,前进!\n\
	冒着敌人的炮火,前进!\n\
	前进!前进、进!\n\n");
	printf("向伟大的祖国致敬 作者YaoLin_X\n不得盗用本人的作品以做违法《国歌法》的事\n若不听劝阻,承担法律责任,本人不负任何责任\n默认用户已经同意");
	Beep(294,TIME/2  ); Beep(392,TIME*3/2); Beep(392,TIME/2  ); Beep(392,TIME*3/4); Beep(392,TIME/4  );
	Beep(294,TIME/2  ); Beep(330,TIME/4  );	Beep(349,TIME/4  ); Beep(392,TIME    ); Beep(392,TIME    );
	Sleep(TIME/2     ); Beep(494,TIME/2  );	Beep(392,TIME/2  ); Beep(440,TIME/4  );	Beep(494,TIME/4  );
	Beep(587,TIME    );	Beep(587,TIME    );	Beep(494,TIME*3/4);	Beep(494,TIME/4  );	Beep(392,TIME*3/4);
	Beep(494,TIME/4  );	Beep(587,TIME*3/4);	Beep(494,TIME/4  );	Beep(440,TIME    );	Beep(440,TIME*2  );
	Beep(659,TIME    ); Beep(587,TIME    );	Beep(440,TIME    ); Beep(494,TIME    );	Beep(587,TIME/2  );
	Beep(494,TIME/2  );	Sleep(TIME/2     );	Beep(587,TIME/2  );	Beep(494,TIME/2  );	Beep(440,TIME/4  );
	Beep(494,TIME/4  ); Beep(392,TIME    );	Beep(494,TIME    );	Sleep(TIME       ); Beep(294,TIME*3/4);
	Beep(330,TIME/4  ); Beep(392,TIME/2  ); Beep(392,TIME/2  ); Beep(494,TIME*3/4); Beep(494,TIME/4  );
	Beep(587,TIME/2  ); Beep(587,TIME/2  );	Beep(440,TIME/2  ); Beep(440,TIME/4  ); Beep(440,TIME/4  );
	Beep(330,TIME    ); Beep(440,TIME*3/2); Beep(294,TIME/2  ); Beep(392,TIME*3/2); Beep(392,TIME/2  );
	Beep(494,TIME*3/2); Beep(494,TIME/2  );	Beep(587,TIME*2  ); Beep(392,TIME*3/4);	Beep(494,TIME/4  );
	Beep(587,TIME/2  ); Beep(587,TIME/2  );	Beep(659,TIME    ); Beep(587,TIME    );	Beep(494,TIME*3/4);
	Beep(392,TIME/4  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(494,TIME/2  );	
	Sleep(TIME/2     );	Beep(392,TIME/2  );	Sleep(TIME/2     );	Beep(294,TIME    );	Beep(392,TIME    );
	Beep(494,TIME*3/4);	Beep(392,TIME/4  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );	Beep(587,TIME/3  );
	Beep(494,TIME/2  );	Sleep(TIME/2     );	Beep(392,TIME/2  );	Sleep(TIME/2     );	Beep(294,TIME    );
	Beep(392,TIME    );	Beep(294,TIME    );	Beep(392,TIME    );	Beep(294,TIME    );	Beep(392,TIME    );
	Beep(392,TIME    );
	return 0;
}

  

 
 
 

你可能感兴趣的:(播放声音 Beep和MessageBeep函数(c++) (windows))