.NET Equivalent for Win32 Beep method

G

Guest

Is there a .NET replacement for the Beep method in the Win32 API? I want to just sound a simple noise when clients move from control to control, or when illegal values are entered

Any help would be appreciated

Thanks,
 
G

Guest

Thanks for the help. I figured I would have to result to the PInvoke option, but was just hoping I wouldn't have too

Thanks

----- Tim Wilson wrote: ----

This should help out
http://groups.google.ca/[email protected]&rnum=

--
Tim Wilso
..Net Compact Framework MV
{cf147fdf-893d-4a88-b258-22f68a3dbc6a
Frank said:
Is there a .NET replacement for the Beep method in the Win32 API? I wan
to just sound a simple noise when clients move from control to control, o
when illegal values are entered
 
V

vijai thoppae

Hello,

You may've to use win32 api using PInvoke. Here's the sample...
sealed class Win32

{

[DllImport("user32.dll")]

public static extern int MessageBeep(uint n);

private Win32()

{

}

//http://msdn.microsoft.com/msdnmag/issues/03/07/net/

/// <summary>

/// Managed call to the win32 beep function.

/// </summary>

/// <param name="type"></param>

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

}

Letme knw if it helps you.

Thanks,
Vijai

Frank said:
Is there a .NET replacement for the Beep method in the Win32 API? I want
to just sound a simple noise when clients move from control to control, or
when illegal values are entered.
 

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

Top