Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "PlaySound" in [All]

winmm

.

static extern bool PlaySound(string pszSound, UIntPtr hmod, uint fdwSound);

.

static extern bool PlaySound(byte[] pszSound, IntPtr hmod, SoundFlags fdwSound);

.

Shared Function PlaySound( _

.

Public Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As String, ByVal hmod As IntPtr, ByVal fdwSound As Integer) As Boolean

.

Public Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As Byte(), ByVal hmod As IntPtr, ByVal fdwSound As SoundFlags) As Boolean

.

    /// <summary>loop the sound until next sndPlaySound</summary>

.

    ''' The sound is played synchronously, and PlaySound returns after

.

    ''' The sound is played asynchronously and PlaySound returns

.

    ''' asynchronously played waveform sound, call PlaySound with

.

    ''' PlaySound returns silently without playing the default sound.

.

    ''' The sound plays repeatedly until PlaySound is called again

.

    ''' <remarks>If this flag is not specified, PlaySound attempts

.

To play a sound looping both SND_LOOP and SND_ASYNC flags have to be specified. Looped sounds only stop when PlaySound is called with pszSound set to NULL.

.

    PlaySound (strFileName, UIntPtr.Zero, (uint)(SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC));

.

public static void Play (byte[] waveData) //bad idea, see http://blogs.msdn.com/larryosterman/archive/2009/02/19/playsound-xxx-snd-memory-snd-async-is-almost-always-a-bad-idea.aspx

.

    PlaySound (waveData, IntPtr.Zero, PlayFlags.SND_ASYNC | PlayFlags.SND_MEMORY);

.

     bool result = PlaySound(@"C:\path\to\wav\file.wav" ,ip ,0);

.

     PlaySound(strFileName, IntPtr.Zero, SoundFlags.SND_FILENAME Or SoundFlags.SND_ASYNC)

.

Public Shared Sub Play(ByVal waveData As Byte()) //bad idea, see http://blogs.msdn.com/larryosterman/archive/2009/02/19/playsound-xxx-snd-memory-snd-async-is-almost-always-a-bad-idea.aspx

.

     PlaySound(waveData, IntPtr.Zero, SoundFlags.SND_ASYNC Or SoundFlags.SND_MEMORY)

.

     Dim result As Boolean = PlaySound("C:\path\to\wav\file.wav", IntPtr.Zero, ip)

.
Documentation
[PlaySound] on MSDN

coredll

.

    public static extern int PlaySound(

.

    Public Shared Function PlaySound( _

.

    public static extern int PlaySound(

.

    Public Shared Function PlaySound( _

.

Private Declare Function PlaySound Lib "coredll" Alias "PlaySoundW" (ByVal szSound As String, ByVal hModule As IntPtr, ByVal flags As PlaySoundFlags) As Boolean

.

Private Declare Function PlaySound Lib "coredll" (ByVal szSound As Byte(), ByVal hModule As IntPtr, ByVal flags As PlaySoundFlags) As Boolean

.

VB PlaySoundFlags Enumeration:

.

    Private Enum PlaySoundFlags As UInt32

.

        SND_LOOP = &H8              ' loop the sound until next sndPlaySound

.

C# PlaySoundFlags Enumeration:

.

    public enum PlaySoundFlags : uint {

.

        SND_LOOP = 0x8,            // loop the sound until next sndPlaySound

.

        public enum PlaySoundFlags : int {

.

            SND_LOOP = 0x8,     // loop the sound until next sndPlaySound

.

            public static extern int PlaySound(

.

                    PlaySound(fileName, IntPtr.Zero, (PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_SYNC));

.

        Private Enum PlaySoundFlags

.

            SND_LOOP = &H8          ' loop the sound until next sndPlaySound

.

     Public Shared Function PlaySound( _

.

                PlaySound(fileName, IntPtr.Zero, PlaySoundFlags.SND_FILENAME Or _

.

                  PlaySoundFlags.SND_SYNC)

.
Documentation
[PlaySound] on MSDN

 
Access PInvoke.net directly from VS: