CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Wav Files

  1. #1
    Join Date
    Oct 2000
    Location
    Upstate NY
    Posts
    249

    Wav Files

    Can someone share the necessary code for playing the sound files included with windows when one hits like a command button. One button for each file would be fine.
    73 RSH


  2. #2
    Join Date
    May 2001
    Location
    Canada
    Posts
    3

    Re: Wav Files

    Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    Public Const SND_sYNC = &H0
    Public Const SND_aSYNC = &H1
    Public Const SND_NODEFAULT = &H2
    Public Const SND_MEMORY = &H4
    Public Const SND_LOOP = &H8
    Public Const SND_NOSTOP = &H10


    Call this sub each time you click on a command button

    Sub PlaySoundClick()
    Dim X As Long
    Dim wFlag As Integer
    Dim SoundName As String

    wFlag = SND_aSYNC Or SND_NODEFAULT
    X = sndPlaySound("C:\Archive\sound1.tmp", wFlag)
    End Sub


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured