Results 1 to 24 of 24

Thread: [RESOLVED] Looping a .wav File

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Resolved [RESOLVED] Looping a .wav File

    I can make it loop, but how do I make it Stop.
    Here is my code, this is in a Module
    Code:
    Option Explicit
    
    Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
             (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
     
    
    
    Private Const SND_SYNC = &H0
    Private Const SND_ASYNC = &H1
    Private Const SND_NODEFAULT = &H2
    Private Const SND_LOOP = &H8
    Private Const SND_NOSTOP = &H10
    Private Const wFlags = SND_ASYNC Or SND_LOOP
    
    Dim X%
    
    Public Sub Play_LOOP(wavFile  as String)
      X = sndPlaySound (wavFile , wFlags)
    End Sub
    
    Public Sub StopPlay_LOOP(wavFile  as String)
      X = sndPlaySound( wavFile, SND_ASYNC )    'wFlags   SND_ASYNC
    End Sub
    The Form
    Code:
    Option Explicit
    
      Dim myFileName$
      
     Private Sub Form_Load()
            myFileName = App.Path & "\tmpClick.wav"
            Play_LOOP myFileName
    End Sub
        
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
           StopPlay_LOOP ""
    End Sub
    Last edited by 5ms?; Oct 29th, 2009 at 10:24 AM. Reason: Update and Add code

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