VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Easy MP3 Player

by ShoreSide (1 Submission)
Category: Sound/MP3
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

One of the easiest MP3 Player's! Don't understand other MP3 complex code...this is for you!

Rate Easy MP3 Player

' Simple MP3 Player
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim isPlaying As Boolean
Dim Mp3File As String
Private Sub Command1_Click(Index As Integer)
  
  Mp3File = Chr$(34) + Trim(Text1.Text) + Chr$(34)
  Select Case Index
   Case 0
    ' Start Playing
    mciSendString "open " + Mp3File, 0&, 0&, 0&
    mciSendString "play " + Mp3File, "", 0&, 0&
    isPlaying = True
   Case 1
    ' Stop Playing
    mciSendString "close " + Mp3File, 0&, 0&, 0&
    isPlaying = False
  End Select
  
End Sub
Private Sub Command2_Click()
  
  Unload Me
  
End Sub
Private Sub Form_Unload(Cancel As Integer)
  If isPlaying = True Then
   ' Stop Playing if we are playing before we exit!
   mciSendString "close " + Mp3File, 0&, 0&, 0&
  End If
  
End Sub

Download this snippet    Add to My Saved Code

Easy MP3 Player Comments

No comments have been posted about Easy MP3 Player. Why not be the first to post a comment about Easy MP3 Player.

Post your comment

Subject:
Message:
0/1000 characters