Playing Sounds in VB 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TNT
    New Member
    • Feb 2007
    • 48

    Playing Sounds in VB 2005

    How do you play sound files in Visual Basic 2005? I have been trying to do it with the Windows Media component. Is this the right tool for the job?
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by TNT
    How do you play sound files in Visual Basic 2005? I have been trying to do it with the Windows Media component. Is this the right tool for the job?
    Did it work for you?

    Comment

    • vijaydiwakar
      Contributor
      • Feb 2007
      • 579

      #3
      Originally posted by TNT
      How do you play sound files in Visual Basic 2005? I have been trying to do it with the Windows Media component. Is this the right tool for the job?
      in vb6 u've to use one api playsound

      Comment

      • willakawill
        Top Contributor
        • Oct 2006
        • 1646

        #4
        Originally posted by vijaydiwakar
        in vb6 u've to use one api playsound
        The question is about visual basic 2005. Not vb6

        Comment

        • vijaydiwakar
          Contributor
          • Feb 2007
          • 579

          #5
          Originally posted by willakawill
          The question is about visual basic 2005. Not vb6
          k........ cool
          I'll try to solve it

          Comment

          • vijaydiwakar
            Contributor
            • Feb 2007
            • 579

            #6
            Originally posted by TNT
            How do you play sound files in Visual Basic 2005? I have been trying to do it with the Windows Media component. Is this the right tool for the job?
            Search for API guid. this guid contains all API's along with examples in vb and .net also. This guid is by kpdteam

            Comment

            • sashi
              Recognized Expert Top Contributor
              • Jun 2006
              • 1749

              #7
              Originally posted by TNT
              How do you play sound files in Visual Basic 2005? I have been trying to do it with the Windows Media component. Is this the right tool for the job?
              Hi there,

              Kindly refer to below code segment, hope it helps. Good luck & Take care.

              Declarations:
              Code:
                Private Declare Auto Function PlaySound Lib "winmm.dll" _
                  (ByVal lpszSoundName As String, ByVal hModule As Integer, _
                   ByVal dwFlags As Integer) As Integer
              
                  Private Const SND_FILENAME As Integer = &H20000
              Code:
              Code:
              Public Function PlayWav(ByVal fileFullPath As String) _
                      As Boolean
              
                      'return true if successful, false if otherwise
                      Dim bAns As Boolean, iRet As Integer = 0
              
                      Try
                          iRet = PlaySound(fileFullPath, 0, SND_FILENAME)
                      Catch
              
                      End Try
               
                     Return iRet
                  End Function

              Comment

              • TNT
                New Member
                • Feb 2007
                • 48

                #8
                Originally posted by willakawill
                Did it work for you?
                Nah, you need a playlist, and it kept saying that it was read-only, which was really annoying.

                Comment

                Working...