We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Playing MP3 with VB6

Medium Priority
Last Modified: 2013-12-20
Hi Experts,

Can you advise me what i need to play MP3 files from VB6
please not to complex, I'm still a newbie in VB :)

Watch Question

Assalam-o-Alaikum Chudzidiot
      Here is the answer regarding to your question in which you said for code to play .MP3 song by VB5/6 coding. This code is working very well. Let’s try and give me feed back. You may run any file which have any format like .MP3, .WAV etc. You can use text2.text value for progress bar change. If you can’t do it, then reply, I will do it for you…. Thanks

      1:  Start new project (form1 will be automatically add)
      2: Add two command buttons automatically named to “command1” & “command2”
      3: Add two text boxes automatically named to “text1” & “text 2”
      4: Add a timer control automatically named to “timer1”, set its “interval” to 500, and “enabled” property to false.
      5: Paste all this code in form’s code window
      6: Change the file path name in  {Form1.FilePath = "D:\MP3SONGS\BAS.MP3"} line as required.
      6: Save the project and run.

‘Code Starts From Here
Option Explicit
Private Declare Function mciSendStringA Lib "winmm.dll" _
(ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long

Public Temp As Integer, ReturnString As String, FilePath As String, Abc As Variant

Public Function SendMCIcommand(TheCommand As String) As String
    ReturnString = String$(128, " ")
    Temp = mciSendStringA(TheCommand, ReturnString, 127, 0)
    SendMCIcommand = ReturnString
End Function

Private Sub Command1_Click()
    Form1.FilePath = "D:\MP3SONGS\BAS.MP3"
    Form1.Abc = SendMCIcommand("open " & Form1.FilePath)
    Form1.Abc = SendMCIcommand("play " & Form1.FilePath)
    Form1.Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
    Form1.Abc = SendMCIcommand("close " & Form1.FilePath)
    Form1.Timer1.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload form1
End Sub

Private Sub Timer1_Timer()
    Form1.Text1.Text = SendMCIcommand("status " & Form1.FilePath & " length")
    Form1.Text2.Text = SendMCIcommand("status " & Form1.FilePath & " position")
End Sub

 ‘Code Ends To Here
Theo KouwenhovenApplication Consultant


Hey JackOfPH,

looks good, but is there a way to skip to a specific point in a mp3?
is there volume controll that is secific for this object,
so if I create SendMCIcommand1 and SendMCIcommand2 thet they will not interfere?

Thanks already !!!


I think you have to create your own class for this...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Theo KouwenhovenApplication Consultant


creating classes is not something a newbie  can do :(

I'm now trying to use "ActiveMovie control Library"
but strugeling with an incorrect duration time :(
Theo KouwenhovenApplication Consultant


Not the right answer, but if brought me to find a solution with 'active Movie Control'
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.