-
C# 键盘Ctrl+g控制蜂鸣器播放声音
Visual C#播放声音,运行程序后,操作键盘上的Ctrl+g组合键发出蜂鸣声...这里的拖放声音是蜂鸣声,从音箱里发出,并不是从机箱的蜂鸣器发声。实现的过程和细节代码如下:
//导入 Windows Beep() API 函数
[DllImport("kernel32.dll")]
private static extern bool Beep(int freq, int dur);
// 定义PlaySound()要使用的常数
public const int SND_FILENAME = 0x00020000;
public const int SND_ASYNC = 0x0001;
// 导入 Windows PlaySound() 函数
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound,
int hmod,
int fdwSound);
[STAThread]
static void Main(string[] args)
{
// 使用Ctrl+g发出蜂鸣声
Console.Write("a");
Console.WriteLine("使用Ctrl+g发出蜂鸣声...");
Console.ReadLine();
// 使用 Windows API 发出蜂鸣声
Beep(800, 200);
Console.WriteLine("使用 Windows API 发出蜂鸣声...");
Console.ReadLine();
// 播放bells.wav文件
PlaySound("bells.wav",
0,
SND_FILENAME | SND_ASYNC);
Console.WriteLine("播放bells.wav文件...");
Console.ReadLine();
}
- 2022-05-23 17:14:52下载
- 积分:1
-
nRFSOC-source-code
nRF无线SOC单片机原理与高级应用源代码(nRF wireless SOC SCM principles and advanced applications source code)
- 2012-08-21 21:54:51下载
- 积分:1
-
G代码解释器
G代码解释器,需要有硬件基础,体量小,控制简单,成本低,后缀名改成cpp查看
- 2023-04-26 04:35:02下载
- 积分:1
-
Camshift
CAMSHIFT的多目标跟踪isMHI结合CAMSHIFT的多目标跟踪(CAMSHIFT的多目标跟踪)
- 2010-09-13 15:57:58下载
- 积分:1
-
TestVirtual
查看面向对象多态执行流程,如果父类函数为纯虚函数,则会执行子类函数.(look at multy status in executing,if farther s function no execute health, execute child s function)
- 2011-01-31 09:48:25下载
- 积分:1
-
CreateParticle-颗粒工厂API源文件
说明: EDEM中颗粒工厂API例子,可以自己套用(The particle factory API example in edem can be applied by itself)
- 2020-11-15 15:59:40下载
- 积分:1
-
HSR-line
高速铁路线路shp格式矢量图,包括电气化快速铁路,时间截止到2015(High speed railway line SHP format vector diagram, including electrification railway fast, time until 2015)
- 2015-12-02 17:22:47下载
- 积分:1
-
EC20-9
说明: STM32F407 开发EC20代码,EC20建立一路SOCKT发数据_TCP(字符和十六进制)(STM32F407 develops EC20 code, EC20 establishes SOCKT sending data _TCP (character and hexadecimal))
- 2019-04-25 09:09:11下载
- 积分:1
-
01_LED
说明: 430单片机中的led显示模块,对于初学者来说,这个程序简单易懂,是学习430的好帮手(430 in single-chip led display module, for beginners, this easy-to-read program is a good helper to learn 430)
- 2009-08-20 17:31:40下载
- 积分:1
-
internal-staffs-learning-materials
华为内部员工学习资料,对于想进华为的朋友会有很大帮助。(The internal staff s learning materials
in huawei is more helpfull for someone who want to go huawei.)
- 2012-02-17 11:43:08下载
- 积分:1