// Aufrufbeispiel
// SpeakerBeep.PlayBeep(1000, 1000);
using System.Runtime.InteropServices;
/// <summary->
/// freeware helper class for creating a onboard system speaker beep
/// (W) 2011 by admin of codezentrale.6x.to
/// </summary->
public static class SpeakerBeep
{
/// <summary->
/// http://pinvoke.net/default.aspx/kernel32.Beep
/// </summary->
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool Beep(uint dwFreq, uint dwDuration);
/// <summary->
/// Plays a beepsound on onboard speaker
/// </summary->
/// <param name="freq"->desired frequency [Hz]</param->
/// <param name="duration"->desired duration [ms]</param->
/// <returns->true, if successfull, otherwise false</returns->
public static bool PlayBeep(uint freq, uint duration)
{
return Beep(freq, duration);
}
}