playing WAVE FILE

Posted on 2004-11-03
Last Modified: 2010-04-23
Hi there.

I need to play a wave file inside a VB.NET routine.
Does anyone help me with some sample code piece?

I'd prefer to use .NET component or native instruction.

Thanks in advance.
Question by:Kupi
    LVL 5

    Assisted Solution

    by:Ignacio Soler Garcia
    LVL 27

    Accepted Solution


        Public Const SND_SYNC = &H0                     'play synchronously (default)
        Public Const SND_NODEFAULT = &H2                'silence not default, if sound not found

        Private Declare Ansi Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

       Public Sub OpenWave(ByVal sVoicefile As String)
            Dim x As Long
            Dim sPath As String = "C:\MYPATH\"
            x = sndPlaySound(sPath & sVoicefile, SND_SYNC Or SND_NODEFAULT)
        End Sub

    Example: OpenWave("C:\Hi.wav")
    LVL 27

    Expert Comment

    Hi Kupi,

    Have you fix your problem with wave files?
    LVL 3

    Author Comment

    Thanks for your help!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    I'm currently working for a company where I have to upgrade over 50 VB6 programs to VB.NET 2008.  So far I'm about half way through, and I've learned quite a few tricks that drastically improve the performance of VB.NET apps. Because there are a…
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now