messagebeep (user32)
Last changed: -92.251.8.36

.
Summary
Plays a waveform sound.

C# Signature:

[DllImport("user32.dll")]
static extern bool MessageBeep(uint uType);

VB Signature:

Declare Function MessageBeep Lib "user32.dll" (uType As Integer) As Boolean

Notes:

You can delete all lines beginning with \\\ or keep it if you are generating documentation from code comments

Requires Windows NT 3.1 or later; Requires Windows 95 or later

Parameter Information

uType

Specifies the sound type, as identified by an entry in the sounds section of the registry. This parameter can be one of the following values:

0xFFFFFFFF - Standard beep using the computer speaker
MB_ICONASTERISK - SystemAsterisk
MB_ICONEXCLAMATION - SystemExclamation
MB_ICONHAND - SystemHand
MB_ICONQUESTION - SystemQuestion
MB_OK - SystemDefault

Tips & Tricks:

Just add the sample code and a using system.runtime.interopservices;

With the enum beepType you get intellisense when you type "beep." and you can then select the kind of beep you want

Sample Code:

    /// <summary>
    /// Enum type that enables intellisense on the private <see cref="Beep"/> method.
    /// </summary>
    /// <remarks>
    /// Used by the public Beep <see cref="Beep"/></remarks>
    public enum beepType
    {
        /// <summary>
        /// A simple windows beep
        /// </summary>            
        SimpleBeep  = -1,
        /// <summary>
        /// A standard windows OK beep
        /// </summary>
        OK    = 0x00,
        /// <summary>
        /// A standard windows Question beep
        /// </summary>
        Question  = 0x20,
        /// <summary>
        /// A standard windows Exclamation beep
        /// </summary>
        Exclamation  = 0x30,
        /// <summary>
        /// A standard windows Asterisk beep
        /// </summary>
        Asterisk  = 0x40,
    }

    [DllImport("User32.dll", ExactSpelling=true)]
    private static extern bool MessageBeep(uint type);

    /// <summary>
    /// Method to call interop for system beep
    /// </summary>
    /// <remarks>Calls Windows to make computer beep</remarks>
    /// <param name="type">The kind of beep you would like to hear</param>
    public static void beep(beepType type)
    {
        MessageBeep((uint)type);
    }

///////////////// ANOTHER EXAMPLE same as the above but shows all beeps.

    class Class1
    {
        public enum beepType
        {
            /// <summary>
            /// A simple windows beep
            /// </summary>            
            SimpleBeep  = -1,
            /// <summary>
            /// A standard windows OK beep
            /// </summary>
            OK    = 0x00,
            /// <summary>
            /// A standard windows Question beep
            /// </summary>
            Question  = 0x20,
            /// <summary>
            /// A standard windows Exclamation beep
            /// </summary>
            Exclamation  = 0x30,
            /// <summary>
            /// A standard windows Asterisk beep
            /// </summary>
            Asterisk  = 0x40,
        }
        [DllImport("User32.dll", ExactSpelling=true)]
        private static extern bool MessageBeep(uint type);

        static void Main(string[] args)
        {
            Class1.beep(beepType.Asterisk);
            Thread.Sleep(1000);
            Class1.beep(beepType.Exclamation);
            Thread.Sleep(1000);
            Class1.beep(beepType.OK);
            Thread.Sleep(1000);
            Class1.beep(beepType.Question);
            Thread.Sleep(1000);
            Class1.beep(beepType.SimpleBeep);
        }
        public static void beep(beepType type)
        {
            MessageBeep((uint)type);
        }

        }
    }

Alternative Managed API:

System.Console.Beep, coming in v2.0 (Whidbey) of the .NET Framework

Documentation
MessageBeep on MSDN