PDA

Click to See Complete Forum and Search --> : Playing Music And Sounds


Insane Killa
Nov 26th, 1999, 07:37 AM
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.

Aaron Young
Nov 26th, 1999, 11:20 AM
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.

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