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: May 7, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT This eSeminar will explore three popular games engines and how they empower developers to create exciting, graphically rich, and high-performance games for Android® on Intel® Architecture. Join us for a deep dive as experts describe the features, tools, and common challenges using Marmalade, App Game Kit, and Havok game engines, as well as a discussion of the pros and cons of each engine and how they fit into your development …

  • With JRebel, developers get to see their code changes immediately, fine-tune their code with incremental changes, debug, explore and deploy their code with ease (both locally and remotely), and ultimately spend more time coding instead of waiting for the dreaded application redeploy to finish. Every time a developer tests a code change it takes minutes to build and deploy the application. JRebel keeps the app server running at all times, so testing is instantaneous and interactive.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds