Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

 

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

 

And you can call the class using the following example

 

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

 

Hope this helps you out

 

Regards

Fat kids are harder to kidnap

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...