[DllImport("winmm.dll", SetLastError=true)]
static extern bool PlaySound(string pszSound,
System.UIntPtr hmod, uint fdwSound);
<DllImport("winmm.dll", charset:=Runtime.InteropServices.CharSet.Auto)> _
Shared Function PlaySound(ByVal lpszName As String, ByVal hModule As System.IntPtr, ByVal dwFlags As Integer) As Boolean
End Function
[Flags]
public enum SoundFlags : int
{
SND_SYNC = 0x0000, // play synchronously (default)
SND_ASYNC = 0x0001, // play asynchronously
SND_NODEFAULT = 0x0002, // silence (!default) if sound not found
SND_MEMORY = 0x0004, // pszSound points to a memory file
SND_LOOP = 0x0008, // loop the sound until next sndPlaySound
SND_NOSTOP = 0x0010, // don't stop any currently playing sound
SND_NOWAIT = 0x00002000, // don't wait if the driver is busy
SND_ALIAS = 0x00010000, // name is a registry alias
SND_ALIAS_ID = 0x00110000, // alias is a predefined id
SND_FILENAME = 0x00020000, // name is file name
SND_RESOURCE = 0x00040004 // name is resource name or atom
}
Standard names:
SystemAsterisk - Asterisk
Default - Default Beep
EmptyRecycleBin - when recycle bin is emptied
SystemExclamation - when windows shows a warning
SystemExit - when Windows shuts down
Maximize - when a program is maximized
MenuCommand - when a menu item is clicked on
MenuPopup - when a (sub)menu pops up
Minimize - when a program is minimized to taskbar
MailBeep - when email is received
Open - when a program is opened
SystemHand - when a critical stop occurs
AppGPFault - when a program causes an error
SystemQuestion - when a system question occurs
RestoreDown - when a program is restored to normal size
RestoreUp - when a program is restored to normal size from taskbar
SystemStart - when Windows starts up
Close - when program is closed
Ringout - when (fax) call is made outbound and the line is ringing
RingIn - incoming (fax) call
public static void Play (string strFileName)
{
PlaySound (strFileName, IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
}
Do you know one? Please contribute it!