MIDI player

Yes, if you use Windows Media will be a pain to wait until it loads, better try the following code, you can put it in a class and call it whenever you want

[VB]
Public Class cSound
Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name As String, ByVal hmod As Integer, ByVal flags As Integer) As Integer

Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_FILENAME = &H20000
Public Const SND_RESOURCE = &H40004

Public Sub PlaySoundFile(ByVal filename As String)
PlaySound(filename, Nothing, SND_FILENAME Or SND_ASYNC)
End Sub
End Class
[/VB]

And you can call the class using the following example

[VB]
Dim oSound as cSound = New cSound
oSound.PlaySoundFile("the path for your sound file")
[/VB]

Hope this helps you out

Regards
 
Back
Top