But coud not get the sound. I can hear just a sound like some error beep sound.
Margaret.
I'll say this a third time Margaret. I can't hear any sounds when I use PlaySound API you have to compile the exe first.
Does your computer play sounds anyway through Windows Media Player?
You can check if you comp can play anything with the waveOutGetNumDevs API.
VB Code:
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Private Sub Form_Load()
Dim rtn As Long
rtn = waveOutGetNumDevs()
If rtn = 0 Then
MsgBox "Your system cannot play Sound Files.", 16, "SoundCard Check"
End If
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
I've had this problem before with playing sounds from resource files. I would hear a beep until I compiled, ran the EXE, and then ran the project again from the IDE.
But I'm guessing you probably already tried this...
I've had this problem before with playing sounds from resource files. I would hear a beep until I compiled, ran the EXE, and then ran the project again from the IDE.
But I'm guessing you probably already tried this...
Edit: Just saw Keith's post.
Yes, I am also having the same problem. My computer plays sounds very well. So, the sound card is ok. Any other possible way to play audio files which are stored in my project folder.
I've put together a little project that uses several variations of the PlaySound APIs. Unzip both files into the same folder and run the project in the IDE, then try compiling it and running the executable. Do any of them work, and if so, which ?
I've put together a little project that uses several variations of the PlaySound APIs. Unzip both files into the same folder and run the project in the IDE, then try compiling it and running the executable. Do any of them work, and if so, which ?
Hi,
No, everytime I play either there is just a beep sound or system hangs.
Well, that answers one question - it looks like your PC has similar problems as DigiRev's and Keithuk's when trying to use the PlaySound APIs. I haven't got any idea what causes it. There are the alternatives such as those mentioned in earlier posts. Also, in my signature - VB - mciSendString - audio/video playback / video splashscreen etc from resource file. Although this is mainly intended as a splashscreen, it can easily be adapted to simply play sounds from a resource file - the form doesn't have to be visible.