Results 1 to 2 of 2

Thread: Playing a wav file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Post

    I want to play a wav file in VB, it is a short file, I want it to be repeated several times in a loop so that it sounds continuous.

    Can anyone help me ?

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Sure thing!
    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_ASYNC = &H1
    Private Const SND_LOOP = &H8
    Private Const SND_NODEFAULT = &H2
    
    Private Sub cmdStart_Click()
        sndPlaySound "C:\WINNT\Media\ding.wav", SND_ASYNC Or SND_LOOP
    End Sub
    
    Private Sub cmdStop_Click()
        sndPlaySound "C:\WINNT\Media\ding.wav", 0
    End Sub
    As you can see, I'm using 2 command buttons: cmdStart and cmdStop. Also, just substitue the file name with the appropriate one.

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819



    [This message has been edited by Serge (edited 12-16-1999).]

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