use vb6 to play an MP3 sound, cmd button event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dennijr
    New Member
    • May 2007
    • 17

    use vb6 to play an MP3 sound, cmd button event

    how do i get vb6 to play a short MP3 sound file when i click a button, if its even possible. ive looked around and found some vb6 MP3 players, so i asume it is possible, but mostly all im finding is code for playing WAV files.
    any response is greatly apreciated
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    I think i've seen that question answered before around here, have you searched it?
    try using sndPlaySound

    Just declare it:

    Private Declare Function sndPlaySound& Lib "winmm.dll" Alias "sndPlaySou ndA" (ByVal lpszSoundName As String, ByVal uFlags As Long)

    and use it:

    sndPlaySound "C:\mySound.wav ", &H1

    you can search the values of the uFlags in google.

    HTH

    Comment

    • dennijr
      New Member
      • May 2007
      • 17

      #3
      Originally posted by kadghar
      I think i've seen that question answered before around here, have you searched it?
      try using sndPlaySound

      Just declare it:

      Private Declare Function sndPlaySound& Lib "winmm.dll" Alias "sndPlaySou ndA" (ByVal lpszSoundName As String, ByVal uFlags As Long)

      and use it:

      sndPlaySound "C:\mySound.wav ", &H1

      you can search the values of the uFlags in google.

      HTH
      yea, i did search it, but like i said, mainly all i found was wav files, and the other problem is that u cant search 3 letter words in the search thing, so i cant search for say "vb6, mp3, etc". and did u notice that what u added was .wav aswell, not mp3? i tried to replace .wav with .mp3 but it wont work.

      Comment

      • vdraceil
        New Member
        • Jul 2007
        • 236

        #4
        Originally posted by dennijr
        yea, i did search it, but like i said, mainly all i found was wav files, and the other problem is that u cant search 3 letter words in the search thing, so i cant search for say "vb6, mp3, etc". and did u notice that what u added was .wav aswell, not mp3? i tried to replace .wav with .mp3 but it wont work.
        Windows Media Player Control can play .mp3 files
        paste a wmp control in your form and include the following code
        Code:
        Private Sub cmd_click
        wmp.url="\\file_path\filename.mp3"
        End Sub

        Comment

        • dennijr
          New Member
          • May 2007
          • 17

          #5
          ty, thats the quick easy fix i needed, and the visible = false setting makes it even better :)

          Comment

          Working...