Beep from PC speaker

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
 
E

Erik Frey

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
 
R

Rami Saad

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Beep() does not work! 10
continuous BIOS beep 2
Make a Beep 3
PC has no video and no beep code?? 29
pc speaker beep?? 6
C#/WPF and Internal Speaker 5
Making a true Beep 1
how to create a WAV file of different tones? 1

Top