How Can I Play Music Just Normal MP3 Music Without Using
Windows Media Player.
Thnx In Advance :)
Printable View
How Can I Play Music Just Normal MP3 Music Without Using
Windows Media Player.
Thnx In Advance :)
you could use the Windows Media Player control, and set visible to false
See our Classic VB FAQs (in the FAQ forum, or via the link in my signature) for examples of a few methods.
Aah Ok Thnx :)
Two ways that you might find helpful are the sndPlaySound API and the MMControl that can be added in VB.
sndPlaySound
This function plays the sound specified by 'lpszPlaySound' parameter. This function is limited to .wav files. An example of use is shown below.
VB Code:
Option Explicit ' Plays the sound specified by ' lpszPlaySound. This function is ' limited to .wav files. Private Declare Function sndPlaySound _ Lib "winmm.dll" _ Alias "sndPlaySoundA" ( _ ByVal lpszSoundName As String, _ ByVal uFlags As Long) _ As Long Private Const SND_NOWAIT As Long = &H2000 ' Don't wait if the driver is busy Private Const SND_SYNC As Long = &H0 ' Play synchronously (default) Private Const SND_FLAGS As Long = SND_SYNC Or SND_NOWAIT ' Combination of two constants above Private Sub Command1_Click() ' Call sndPlaySound to play our file Call sndPlaySound(App.Path & "\Chimes.wav", SND_FLAGS) End Sub
MMControl
This is a control that can be added through Visual Basic 6.0 by going to Project > Components and selecting 'Microsoft Multimedia Control 6.0'. This control can play a mixture of sound types and is of more use than sndPlaySound if you are playing music through VB. An example on using this is below:
VB Code:
Private Sub Form_Load() With MMControl1 .FileName = App.Path & "\Sound.wma" ' Set the file to be played .Command = "Open" ' Open the file .Command = "Play" ' Play the file End With End Sub
Hope this is of some help :wave:
I hope you don't mind Jenova, but I copied your post to the FAQ thread (as your methods weren't in it already).
No that's fine :D. Thanks a lot :wave:
Aah This Is What I Searched For :D
Yhnnxx Man Reaaly Thnx :D
No Errors, But It Doesnt Play The Music
Does It Only Works For .Wav Sounds
Cuz I Wanted To Play .MP3 Files
VB Code Code:
Call sndPlaySound("C:\Documents and Settings\Administrator\My Documents\My Music\Other\Wai A Pasi.mp3", SND_FLAGS)
Yes:Quote:
Originally Posted by XCustoms
Try a different method. ;)Quote:
Originally Posted by Jenova
MP3 File Worked But Only With MMControl But Not Normal :(
I Want To Create My Own Button :)
When you say Create your own button can you be more specific? Do you mean you want to press a button and play the file? If that is the case you just need to use the code that i showed you before in a button click event.
VB Code:
Private Sub Command1_Click() With MMControl1 .FileName = App.Path & "\Sound.wma" ' Set the file to be played .Command = "Open" ' Open the file .Command = "Play" ' Play the file End With End Sub
Hope this helps