Results 1 to 2 of 2

Thread: Playing Music And Sounds

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    65

    Post

    I have Visual Basic 4.0 32 bit
    and for a program I am making I need it to play a wav file when someone clicks on the main picture, can someone help me out with a code? and give me full instructions on where to put each part of the code because I am a real dumb ass.

    Thanx.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    Not much to it, just use the sndPlaySound API, pass it a File Path/Name and the Required Flag.
    SND_ASYNC Just allows processing to continue whilst the Sound is being played.
    Code:
    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 Sub Picture1_Click()
        sndPlaySound "C:\Windows\Media\CtMelody.wav", SND_ASYNC
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

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