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

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • VMware vCloud® Government Service provided by Carpathia® is an enterprise-class hybrid cloud service that delivers the tried and tested VMware capabilities widely used by government organizations today, with the added security and compliance assurance of FedRAMP authorization. The hybrid cloud is becoming more and more prevalent – in fact, nearly three-fourths of large enterprises expect to have hybrid deployments by 2015, according to a recent Gartner analyst report. Learn about the benefits of …

Most Popular Programming Stories

More for Developers

RSS Feeds