Beeping in C#

Environment: .NET, Visual Studio .NET, C#

This is part of a collection of C# programs that I wrote when I wanted to learn C# and .NET. I call these type of programs "Exploratory Programming." They are all short applications that demonstrate some part of .NET and the forms interface that I couldn't find in any book I had. All the programs are simple interactive examples.

I believe in auditory debugging when necessary, putting a sound in routines so you know they were entered but don't have to sit in the debugger setting break points unless you have to. .NET doesn't seem to have the equivalent of the WIN32 MessageBeep(nn) function. The following will enable it from C#:

using System.Runtime.InteropServices;           //reference
                                                //the name space
                                                //for use

public class Form1 : System.Windows.Forms.Form  //or whatever you
                                                //call the class
                                                //of your
                                                //application

{

[DllImport("user32.dll")]

public static extern boolMessageBeep(intSound);

Downloads

Not applicable



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Cisco and Intel have harnessed flash memory technology and truly innovative system software to blast through the boundaries of today's I/O-bound server/storage architectures. See how they are bringing real-time responsiveness to data-intensive applications—for unmatched business advantage. Sponsored by Cisco and Intel® Partnering in Innovation

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds