Click to See Complete Forum and Search --> : How can I play music file MP3 in VB?
lejohn
Dec 15th, 1999, 07:22 AM
Dear Masters' VB
Please help me, How can I play music file MP3 in VB?
Many thanks for your help.
Gerald
Dec 15th, 1999, 08:17 AM
There are 3 ways you could do it--each having a different level of complexity.
1. Use the shell function to launch your MP3 with Window's mplayer or mplayer2.
Shell ("mplayer.exe /play C:\your.mp3", vbMinimizedNoFocus)
2. Add the MS Multimedia control to a form.
MMControl1.Wait = True
MMControl1.FileName = "C:\your.mp3"
MMControl1.Command = "Open"
3. Make direct use of the Window's multimedia API calls.
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Sub Command1_Click()
mciExecute ("play c:\your.mp3")
End Sub
Gerald M.
[This message has been edited by Gerald (edited 12-15-1999).]
Immortal Knight
Aug 2nd, 2006, 05:51 AM
hey,
the third funsction does not work is there anything wrong with it or is it just my stupid machine.
schoolbusdriver
Aug 2nd, 2006, 10:39 AM
mciExecute (a simplified version of mciSendString) will fail if the path to the file contains spaces (isn't in DOS 8.3 format). Use GetShortPathName to returns a valid path/file name.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.