?
Solved

How Can I play .wav files?

Posted on 2003-03-25
4
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

762 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