Hey guys, i need a wave sound file for my program i am working for a basic tutorial for grade school and pre-scool so i am looking for a sound file that fitted to my quiz in pre-school i can`t find in google or to any sites..

you must locate your sound file (abcd.wav) at the dirrectory that contain vb6 application.

private sub cmd1_click()
on error resume next
soundfile= App.path & "/" & "abcd.wav"
returnaval=playsound(soundfile, 0, &H0)
Endsub

hope this will help you.

Edited 4 Years Ago by mahela

sorry I forgot the most improtant part.please use below code set.

Private Declare Function PlaySound Lib _
"winmm.dll" _
(ByVal lpszName As String, ByVal _
hModule As Long, ByVal dwFlags As Long) As Long


private sub cmd1_click()
on error resume next
soundfile= App.path & "/" & "abcd.wav"
returnaval=playsound(soundfile, 0, &H0)
Endsub

sorry for the lost code set.enjoy now.

The code is perfectly fine, but what i understand from the question is the OP is aking for a wave file not how to play it. OP needs a file not the code to open it.

Oh I see.you are correct.you can use wave file making software like..
Click Here
hope it may help you to make your own wave file.

Hi!

Your problem is the first opportunity for me to finally post something here.

Your quiz software is probably very specific therefore you cannot find anything that will fill your needs . I had the same situation some time ago and found the following solution;

You can record your own wave using Audacity (freeware) then save it using whatever name you and directory you wish then in your Form declaration section insert the following code ( on 1 line )

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Insert the following code in the command button ( or whatever else you are using) to play the file.
retval = PlaySound("C:\wave directory name\filename.wav", 0&, &H20000)

Remember to change the directory name and filename to coincide with yours

I hope it solves the problem for you as it did for me

This article has been dead for over six months. Start a new discussion instead.