473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Beep

I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks
Jul 21 '05 #1
3 1421
[DllImport("kernel32.dll")]
public static extern bool Beep(int freq,int duration);


Best Regards,



Ido Samuelson

Senior Consultant

Advantech – Microsoft Division (Magen)

id**@advantech.co.il


http://www.magen.com
"Paul DeWitt" <Pa********@discussions.microsoft.com> wrote in message news:74**********************************@microsof t.com...
I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks
Jul 21 '05 #2
On Sun, 26 Jun 2005 16:16:05 -0700, "Paul DeWitt"
<Pa********@discussions.microsoft.com> wrote:
I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks


Use '\a' ('a' for Alert):

namespace Beep {
class Program {
static void Main(string[] args) {
Console.WriteLine("\a");
}
}
}

rossum
The ultimate truth is that there is no ultimate truth
Jul 22 '05 #3
Ho hum.... so boring... Try this instead:

1. Install DirectX 9.0 SDK
2. Create a Windows Forms application
3. Add a reference to Microsoft.DirectX.DirectSound
4. Add the following code:

using Microsoft.DirectX.DirectSound;
....
private void button1_Click(object sender, System.EventArgs e)
{
Device dev = new Device();
dev.SetCooperativeLevel(this,CooperativeLevel.Norm al);
BufferDescription buffer_desc = new BufferDescription();
SecondaryBuffer buffer = new SecondaryBuffer(
@"C:\WINDOWS\Media\ding.wav",
buffer_desc,
dev);
buffer.Play(0,BufferPlayFlags.Default);
}

Or use any wav file you like -- Live a little!!!!

- Harlow.

"Ido Samuelson" wrote:
[DllImport("kernel32.dll")]
public static extern bool Beep(int freq,int duration);


Best Regards,

Ido Samuelson

Senior Consultant

Advantech – Microsoft Division (Magen)

id**@advantech.co.il


http://www.magen.com
"Paul DeWitt" <Pa********@discussions.microsoft.com> wrote in message news:74**********************************@microsof t.com...
I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Leo | last post by:
hi there i want python to do a beep. in the docu i found in tkinter the method bell() but the script: import Tkinter Tkinter.bell() gives the error:
3
by: #Hai | last post by:
Hi, I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ? Thanks
19
by: Anon Email | last post by:
Hi everyone, Let's see, now. This question is about the capabilities of ANSI C++. I want to write and compile code in ANSI C++ that, when compiled, will make the computer speaker beep; or, at...
8
by: Marcia Gulesian | last post by:
How can I create a beep in javascript (I.E. 5.5 +) ?
2
by: Hai Ly Hoang | last post by:
Hi, I want to make a beep from PC speaker (like C++ beep(), not a beep from sound-card). How to do that ? Thanks
4
by: Kartic | last post by:
Hi, My program needs to open another form(Form2) at form1 load. But Form2 always opens with a beep. How do I get rid of that beep. I tried to load form2 from Form1 activate also but with no...
4
by: Rich | last post by:
Hello, I want to use the Beep() to alert users about certain messages but in my workstation I can't get a sound out of it. But Beep works in VB6. What do I need to do? Sub... .... Beep()...
4
by: adi | last post by:
Hi My application has many automatic features because it is designed to run without any user interfering. In fact, my app will work on a system without a keyboard or a mouse. Anyway, from time...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a way to suppress the beep? How to do this? ...
5
by: =?Utf-8?B?UmFmYWVs?= | last post by:
I'm studying C# (I've been a VB developer). I'm making some tests and I need to use Console.Beep(), but it doesn't make any sound, no matter if I try it in VS2008 beta or VS2005. Could anybody...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.