1

I want to play a beep for 1 second in thread. I'm not familiar with threads and maybe there is another easy way without using threads. I used console.beep(), but unfortunately it freeze's the form for a second.

while(true)
{
   do some jobs;
   console.beep();
}

The Winform app freeze on the console.beep(); for one second. I need to pass the line and simultaneously beep for one second.

UserMat
  • 600
  • 4
  • 10
  • 27

1 Answers1

2

You can use

using System.Media;


    SystemSounds.Beep.Play();

And Play() doesn't block so you don't need a Thread. It plays whatever is configured in the User's sytem sound settings.

But if you need to know when the sound has finished this is not what you want.

How to: Play a Beep from a Windows Form

H H
  • 263,252
  • 30
  • 330
  • 514