Beep from PC speaker

  • Thread starter Thread starter Hai Ly Hoang
  • Start date Start date
H

Hai Ly Hoang

Hi,
I want to make a beep from PC speaker (like C++ beep(), not a beep from
sound-card).
How to do that ?
Thanks
 
Hai Ly Hoang said:
Hi,
I want to make a beep from PC speaker (like C++ beep(), not a beep from
sound-card).
How to do that ?
Thanks

[System.Runtime.InteropServices.DllImport("kernel32.dll")]
private static extern bool Beep( int freq, int dur );

Beep(500,1000);

Erik
 
using System.Runtime.InteropServices;

[DllImport("KERNEL32.DLL",
EntryPoint="Beep",SetLastError=true,CharSet=CharSet.Unicode,
ExactSpelling=true,CallingConvention=CallingConvention.StdCall)]

public static extern bool Beep(int x,int y);

//you code

Beep(500,1000); //500 and 1000 are number of pitch, and duration
 
Back
Top