?
Solved

How Can I play .wav files?

Posted on 2003-03-25
4
Medium Priority
?
210 Views
Last Modified: 2010-04-17
How can I play .wav files from a VB code?
I have been trying objects from the MSMedia Player library, but it does not work.
   I will appreciate any help, Thanks in advance

                        Jigr
0
Comment
Question by:jigr
  • 2
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 225 total points
ID: 8205864
use this:

Private Declare Function PlaySound _
                Lib "winmm.dll" _
                Alias "PlaySoundA" _
                (ByVal lpszName As String, _
                ByVal hModule As Long, _
                ByVal dwFlags As Long) As Long
Private Const snd_async = &H1
Public Sub PlayWAVSound(Optional ByVal pstrFilePath As String)
Dim lngResult As Long

    If Len(Trim$(pstrFilePath)) = 0 Then
        pstrFilePath = App.Path & "\StartProcess.wav"
    End If
    lngResult = PlaySound(pstrFilePath, 0, snd_async)
    If lngResult = 0 Then
        Beep
        Beep
        Beep
    End If
End Sub
0
 

Author Comment

by:jigr
ID: 8206111
It worked, Thank you emoreau
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8207023
why a "B" ?
0
 

Author Comment

by:jigr
ID: 8210014
Perhaps i was a bit ungratefull, the solution did what it was required to, so if makes you feel better, i recognize that it deserved an excellent mark. I'm new at this and i thougth the points were more important. I'll have it mind for the future

                        Jigr
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question