Playing wav file in VB 
Author Message
 Playing wav file in VB

How can i play a wav file in Visual Basic ?

Please help me...



Fri, 06 Oct 2000 03:00:00 GMT  
 Playing wav file in VB

Include the following lines in the declarations of your module:

Public Const SND_ASYNC = &H1        
Public Const SND_SYNC = &H0        
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Then, simply call the function:

lRes = sndPlaySound( "c:\Media\SomeWave.Wav",SND_ASYNC)

That's all there is to it.
Use SND_ASYNC as the second parameter if you want the function to return
control as soon as it starts playing the WAV file; or SND_SYNC if you only
want control back once the WAV file has been played completely.

Hope this helps,

Fil



Quote:

> How can i play a wav file in visual basic ?

> Please help me...



Sat, 07 Oct 2000 03:00:00 GMT  
 Playing wav file in VB

Note that if you want to play wave files from resources, you should do :

Public Const SND_MEMORY = &H4
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(lpszSoundName as Any, ByVal uFlags As Long) As Long

then... (to play resource ID 2000)
    Dim data() as Byte

    data = LoadResData( "2000", "WAVE")
    retval = sndPlaySound( Data(0), SND_MEMORY)

Using the SND_RESOURCE flag didn't seem to work in VB no matter which way i
declared the function...

Quote:

>Include the following lines in the declarations of your module:

>Public Const SND_ASYNC = &H1
>Public Const SND_SYNC = &H0
>Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
>(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

>Then, simply call the function:

>lRes = sndPlaySound( "c:\Media\SomeWave.Wav",SND_ASYNC)

>That's all there is to it.
>Use SND_ASYNC as the second parameter if you want the function to return
>control as soon as it starts playing the WAV file; or SND_SYNC if you only
>want control back once the WAV file has been played completely.

>Hope this helps,

>Fil



>> How can i play a wav file in visual basic ?

>> Please help me...



Tue, 10 Oct 2000 03:00:00 GMT  
 Playing wav file in VB

PLAYWAV ("filename.wav")



Sun, 15 Oct 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to play .wav file in vb.net

2. Playing WAV files from VB programs

3. to play wav file in VB

4. Play wav-files in VB 1.0??

5. playing wav files with vb

6. How to play Wav-Files in VB 4 ?

7. playing .wav files with vb

8. Playing WAV files in VB

9. Playing wav files with VB for Windows 95

10. How to play .wav files in VB 3?

11. HELP! with playing WAV files from VB

12. How to play .WAV file in VB

 

 
Powered by phpBB® Forum Software