Marinus Holkema said:
*** Oh Yes! ***
Have fun!
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
<snipped>
#region Windows Form Designer generated code
<snipped>
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
//******************
new Class1(1);
//******************
}
}
}
using System;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
public class Class1
{
[DllImport("kernel32.dll")]
public static extern bool Beep(int frequuency, int duration);
int tone;
public Class1(int tone)
{
this.tone = tone;
execute();
}
void execute()
{
if (tone == 0)
{
Random random = new Random();
for(int i = 0; i < 10000; i++)
{
Beep(random.Next(1000),100);
}
}
if(tone == 1)
{
Beep(800,100);
Beep(900,100);
Beep(800,100);
}
}
}
}