C#中使用API来实现BEEP
来源:互联网 发布:因网络暴力自杀的明星 编辑:程序博客网 时间:2024/06/05 18:44
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices; //之前必须要添加此引用!
namespace BEEP
...{
public class Form1 : System.Windows.Forms.Form
...{
private System.ComponentModel.Container components = null;
public Form1()...{LoadForm();}
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices; //之前必须要添加此引用!
namespace BEEP
...{
public class Form1 : System.Windows.Forms.Form
...{
private System.ComponentModel.Container components = null;
public Form1()...{LoadForm();}
/******************************关键在此, 不要改.************************/
[DllImport("kernel32.dll")]
private static extern bool Beep(int freq, int dur);
public const int SND_FILENAME = 0x00020000;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
public const int SND_ASYNC = 0x0001;
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound,int hmod,int fdwSound);
/**************************************************************************/
protected override void Dispose( bool disposing )
...{
if( disposing )
...{
if (components != null)
...{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void LoadForm()
...{
//..............窗体控件初始化,省略............//
}
[STAThread]
static void Main()
...{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
...{
try
...{
Beep(int.Parse(textBox1.Text),int.Parse(textBox2.Text));
[DllImport("kernel32.dll")]
private static extern bool Beep(int freq, int dur);
public const int SND_FILENAME = 0x00020000;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
public const int SND_ASYNC = 0x0001;
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound,int hmod,int fdwSound);
/**************************************************************************/
protected override void Dispose( bool disposing )
...{
if( disposing )
...{
if (components != null)
...{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void LoadForm()
...{
//..............窗体控件初始化,省略............//
}
[STAThread]
static void Main()
...{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
...{
try
...{
Beep(int.Parse(textBox1.Text),int.Parse(textBox2.Text));
/* ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ */
/* 数值1 数值2 */
}
catch...{
}
}
}
}
}
catch...{
}
}
}
}
- C#中使用API来实现BEEP
- 关于C#中调用Beep()
- Beep使用
- C#中使用位运算来实现权限管理
- C#中使用位运算来实现权限管理
- C#实现音乐之声Console.Beep曲目
- 关于用mongodb java api 来实现在$project中使用$substr函数的方法
- IONIC 中使用拦截功能来实现API接口访问的数据缓存
- C#调用API来实现打开webbrowser中的链接
- 在C#中 API 实现串口通信
- 在WinForm中使用Web Services 来实现 软件 自动升级( Auto Update ) (C#
- C#中使用API函数ShellExecute
- C#中通过DllImport使用 Win32 API
- C#中通过DllImport使用 Win32 API
- C#中通过DllImport使用 Win32 API
- C#中通过DllImport使用 Win32 API
- C#中通过DllImport使用 Win32 API
- C#中windos API SendMessage的使用
- (转载) 在C#程序中实现热键
- 用户 NT AUTHORITYNETWORK SERVICE 登录失败解决方法
- 安装sql2000,提示有程序以挂起的解决方案
- (转载) 用JS读取XML文件
- (原创) 简单的用反射机制读取XML并以树状显示
- C#中使用API来实现BEEP
- 去掉VS2005中VC8的警告错误:warning C4819: 该文件包含不能在当前代码页(936)中表示的字符...
- 作业:递归实现插入排序和在o(nlgn)时间复杂度内寻找和为定值的两个元素
- MD5算法的C++实现
- 非完美C++ Singleton实现[1]
- 非完美C++ Singleton实现[2]
- Crystal Report开发报表
- 三句话是如何暴露自己不职业的
- 常用的T-SQL语句和函数