Beep Win32

  • Thread starter Thread starter pnp
  • Start date Start date
P

pnp

When this executes

Win32.MessageBeep(BeepTypes.IconExclamation);

(or any of the other beep types) nothing is heard...

Any Ideas?

-----------------------------------------------------------

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;

.....

sealed class Win32
{
[DllImport("user32.dll")]
public static extern int MessageBeep(uint n);

private Win32()
{
}

public static void MessageBeep(BeepTypes type)
{
if(MessageBeep((UInt32) type) == 0)
{
Int32 err = Marshal.GetLastWin32Error();
throw new Win32Exception(err);
}
}
}


enum BeepTypes
{
Simple = -1,
Ok = 0x00000000,
IconHand = 0x00000010,
IconQuestion = 0x00000020,
IconExclamation = 0x00000030,
IconAsterisk = 0x00000040
}
 
hi
try this
using System;
using System.Runtime.InteropServices;

class MyBeep
{
[DllImport("kernel32.dll")]
public static extern bool Beep(int frequency, int duration); // these
prams determine the beep

static void Main(string[] args)
{
Beep(1000, 2000);
}
}


Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top