C# 编写服务器端错误警报发出声音
引用 using System.Runtime.InteropServices;
固定编写的方法:
/// <summary>
/// APIFunctions 包含系统中对API的调用的类
/// </summary>
public class APIFunctions
{
/// <summary>
/// PCI喇叭的频率
/// </summary>
public const int FREQ = 2000;
/// <summary>
/// PCI喇叭的持续时间
/// </summary>
public const int DURATION = 1000;
[DllImport("kernel32.dll", EntryPoint = "Beep")]
public static extern int Beep(int dwFreq, int dwDuration);
/// <summary>
/// 通过此方法发出声音通知用户
/// </summary>
public static void CollateBeep()
{
Beep(FREQ, DURATION);
}
}
调用:
APIFunctions.CollateBeep();
C# 编写客户端错误警报发出声音
没找到什么好的方法:
Response.Write("<embed src='sound/factory.mid' hidden='true'/>");