DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   how to play wav file (http://www.daniweb.com/forums/thread117440.html)

november_pooh Apr 4th, 2008 2:09 pm
how to play wav file
 
hi...
i want to play wav file on my form.
ex : media file on windows -> C:\WINDOWS\MEDIA\TADA.WAV
how can i do this??
please help me

thanks. best regards :)

november_pooh Apr 4th, 2008 2:13 pm
Re: how to play wav file
 
but i don't wanna to use media player or other component, cause it make me to add new component.

please help me Gurus...

Sawamura Apr 4th, 2008 2:25 pm
Re: how to play wav file
 
if u didn't want to use any component, u can use api file to play it.

november_pooh Apr 4th, 2008 2:37 pm
Re: how to play wav file
 
please give an example...i don't know how to use api...

november_pooh Apr 4th, 2008 2:42 pm
Re: how to play wav file
 
anyone please....

Jx_Man Apr 4th, 2008 2:44 pm
Re: how to play wav file
 
try this following code :
Private Const SND_APPLICATION = &H80         '  look for application specific association
Private Const SND_ALIAS = &H10000    '  name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000    '  name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1        '  play asynchronously
Private Const SND_FILENAME = &H20000    '  name is a file name
Private Const SND_LOOP = &H8        '  loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4        '  lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2        '  silence not default, if sound not found
Private Const SND_NOSTOP = &H10        '  don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000      '  don't wait if the driver is busy
Private Const SND_PURGE = &H40              '  purge non-static events for task
Private Const SND_RESOURCE = &H40004    '  name is a resource name or atom
Private Const SND_SYNC = &H0        '  play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Private Sub Form_Load()
    PlaySound "C:\WINDOWS\MEDIA\TADA.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
 
End Sub

november_pooh Apr 4th, 2008 3:27 pm
Re: how to play wav file
 
thanks sawamura for the direction..

november_pooh Apr 4th, 2008 3:28 pm
Re: how to play wav file
 
thanks for the example jx_man.
you're very helping, it was i looking for.

Jx_Man Apr 4th, 2008 3:33 pm
Re: how to play wav file
 
you're welcome friend.
Happy coding :)


All times are GMT -4. The time now is 8:58 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC