Search Tools Links Login

Easy MP3 Player


Visual Basic 6, or VB Classic

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

Original Author: ShoreSide

Code

' 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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 103 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.