Results 1 to 3 of 3

Thread: Playing Sound

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    25
    Can anyone tell me a simple way to play a wave file. I have started to look at the MMcontrol but though I would first look for a more simpiler way.
    TIA

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    you can use the API fxn, "sndPlaySound".
    the declaration is:

    Public Declare Function sndPlaySound& lib "winmm.dll" Alias
    "sndPlaySoundA" (byval lpszSoundName as string, byval
    uFlags as long)

    'WAV Sound values
    Global Const SND_SYNC = &H0
    Global Const SND_ASYNC = &H1
    Global Const SND_NODEFAULT = &H2
    Global Const SND_LOOP = &H8
    Global Const SND_NOSTOP = &H10


  3. #3
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    an example on how to use the above fxn...

    Code:
    ' Declare the API and the global variables
    
    ' say you want to play wav on a button's on
    '    click action
    Private Sub Command1_Click()
    
    Dim wFlags%
    Dim x%
    Dim tmpSoundName As String
    
        tmpSoundName = "c:\windows\chimes.wav"
        wFlags% = SND_ASYNC Or SND_NODEFAULT
        x% = sndPlaySound(tmpSoundName, wFlags%)
    
    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