Skip to content

Instantly share code, notes, and snippets.

@kakkun61
Created January 18, 2021 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kakkun61/982227fecfaca0e1b9080b9fe4307e96 to your computer and use it in GitHub Desktop.
Save kakkun61/982227fecfaca0e1b9080b9fe4307e96 to your computer and use it in GitHub Desktop.
namespace Wintellect.Interop.Sound
{
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
sealed class Sound
{
public static void MessageBeep(BeepTypes type)
{
if (!MessageBeep((UInt32) type))
{
Int32 err = Marshal.GetLastWin32Error();
throw new Win32Exception(err);
}
}
[DllImport("User32.dll", SetLastError=true)]
static extern Boolean MessageBeep(UInt32 beepType);
private Sound(){}
}
enum BeepTypes
{
Simple = -1,
Ok = 0x00000000,
IconHand = 0x00000010,
IconQuestion = 0x00000020,
IconExclamation = 0x00000030,
IconAsterisk = 0x00000040
}
}
BOOL MessageBeep(
UINT uType // beep type
);
[DllImport("User32.dll")]
static extern Boolean MessageBeep(UInt32 beepType);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment