private void PlaySound()
{
PlaySound(("声音文件", IntPtr.Zero, 0); //用API播放声音文件
}
private void Play()
{
System.Media.SystemSounds.Asterisk.Play();
}
private void ProcessPlay()
{
System.Diagnostics.Process.Start("声音文件");
}
private void Beep()
{
Random random = new Random();
for (int i = 0; i < 10000; i++)
{
Beep(random.Next(10000), 100);//频率要>800
}
}
[DllImport("winmm.dll", EntryPoint = "PlaySound")]
private static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound);
[DllImport("kernel32.dll")]
public static extern bool Beep(int frequency, int duration);