Tiago_22 Posted March 25, 2006 at 01:01 PM Report Share #19421 Posted March 25, 2006 at 01:01 PM Boas! Eu estou a tentar fazer um reprodutor de mp3, mas estou a ter algumas dificuldades... O meu form tem 2 botoes, uma drivebox, uma dirbox, uma filebox, uma listbox e o reprodutor do win media player. eu ja consegui reproduzir musica, mas é so uma... ao inicio 😄 pus es te codigo pa reproduzir musa ao inicio: Private Sub Form_Load() WindowsMediaPlayer1.URL = "C:\Documents and Settings\Tiago\Os meus documentos\A minha música\02-Jonh Cena - Right now.mp3" End Sub mas agr estou com problemas em adicionar as musicas na filebox para um listbox para depois reproduzir 🙂 e tou a tentar com este codigo no botao adicionar Private Sub Add_Click() selectedfile = File1.Path & "\" & File1.FileName lista.AddItem = File1.FileName End Sub e com este no botao adicionar todas Private Sub AddAll_Click() Dim i As Integer For i = 0 To File1.ListCount - 1 lista.AddItem Dir1.Path & "\" & File1.List(i), File1.List(i) Next lista.AddItem = File1.ListCount End Sub Se alguem me poder ajudar, agradeço 😉 cumps 😉 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 01:06 PM Report Share #19422 Posted March 25, 2006 at 01:06 PM Eu já fiz uma coisa parecida, mas em vb.net...posso-te mostrar se tiveres a usar vb.net 2003 Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 25, 2006 at 01:12 PM Author Report Share #19424 Posted March 25, 2006 at 01:12 PM yap podes ser, eu agr usu o vb 6 pk é o k se da na escola, mas tb tenhu o vb.net 2003 ? qd poderes, poes aki o codigo, sff cumps 😉 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 01:20 PM Report Share #19426 Posted March 25, 2006 at 01:20 PM Bem, o que interessa para o teu caso é só isto: Private Sub Timer18_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer18.Tick If MediaPlayer1.FileName = TextBox15.Text Then If (MediaPlayer1.Duration - MediaPlayer1.CurrentPosition) = 0 Then MediaPlayer1.Stop() MediaPlayer1.FileName = TextBox16.Text If TextBox16.Text = "" Then MediaPlayer1.Stop() Else Try MediaPlayer1.Play() Catch exception As Exception MessageBox.Show("Erro." & vbLf & "O ficheiro seleccionado poderá estar danificado," & vbLf & _ "experimente abri-lo com outro porgrama de reprodução.", "mp DiskJockey", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Timer18.Enabled = False Timer19.Enabled = True End If End If End If End Sub Que é o que permite abrir a entrada da listbox seguinte, isso tem de estar no timer, e é só mudar onde diz textbox 😉 Link to comment Share on other sites More sharing options...
David Pintassilgo Posted March 25, 2006 at 03:41 PM Report Share #19443 Posted March 25, 2006 at 03:41 PM Dá uma vista de olhos aqui: cool stuffs to check. http://blog.zxcoders.com// Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 25, 2006 at 07:22 PM Author Report Share #19472 Posted March 25, 2006 at 07:22 PM boas outra x! d_pintassilgo descarreguei o ficheiro, mas n me ajudou mt... pk n consegui ver o codigo... deu erro. qual o codigo k devo meter no botoes adicionar e adicionar todos (que adiciona o(s) ficheiro(s) selecionados da filebox numa listview)? é k o meu ñ funciona 😉 cumps 😉 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 07:31 PM Report Share #19473 Posted March 25, 2006 at 07:31 PM Se fosse um de cada vez.... agora todos.... :| Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 25, 2006 at 07:37 PM Author Report Share #19474 Posted March 25, 2006 at 07:37 PM e podes por como se poem 1 de cada vez, sff cumps 😉 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 07:42 PM Report Share #19476 Posted March 25, 2006 at 07:42 PM Bem, 'General declarations Dim x As Integer 'Sub Private Command1_Click () CommonDialog1.ShowOpen ListBox1.Additem (x, Commondialog1.Filename) x=x+1 End Sub Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 25, 2006 at 08:45 PM Author Report Share #19480 Posted March 25, 2006 at 08:45 PM boas, ñ percebi o porquê do CommonDialog1 ? podem-m explicar o k faz cumps 😉 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 09:38 PM Report Share #19485 Posted March 25, 2006 at 09:38 PM boas, ñ percebi o porquê do CommonDialog1 ? podem-m explicar o k faz cumps 😉 É um componente que tens de adicionar e que te dá acesso às janelas típicas do windows. Tipo a que te aparece se fizeres no ward abrir, ou guardar como. 😉 Link to comment Share on other sites More sharing options...
M@KO Posted March 25, 2006 at 10:02 PM Report Share #19487 Posted March 25, 2006 at 10:02 PM Boas!! Olha uma maneira simples: poes no form isto DirListBox FileListBox ListBox MediaPlayer Botao E fazes este codigo Private Sub botao_Click() wmp.FileName = (List1) End Sub Private Sub Dir1_Change() File1.Path = Dir1 End Sub Private Sub File1_Click() List1.AddItem (Dir1 & "\" & File1) End Sub Private Sub Form_Load() Dir1.Path = "C:" File1.Pattern = "*.mp3" End Sub ao carregares no botao toca a musica selecionada na list1 cool stuff http://blog.zxcoders.com/ Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 10:12 PM Report Share #19488 Posted March 25, 2006 at 10:12 PM wow, esse trick não conhecia... Mas ainda assim prefiro o commondialog ao drivelist box.. mas esse método de passar como filename ao wmp toda a listbox é engenhoso sim senhor... gostei,,, 😉 Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 25, 2006 at 10:59 PM Author Report Share #19493 Posted March 25, 2006 at 10:59 PM tks M@KO codigo mt bom 😉 tks vbmaster e d_pintassilgo ja consegui por a reproduzir mp3 😉 cumps 😄 Link to comment Share on other sites More sharing options...
vbmaster Posted March 25, 2006 at 11:21 PM Report Share #19495 Posted March 25, 2006 at 11:21 PM mas usa o commondialog que rulla mais 😉 Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 26, 2006 at 05:36 PM Author Report Share #19564 Posted March 26, 2006 at 05:36 PM vbmaster eu dps tambem faço um com o commondialog, pa ver o k rulla mais 🙂 M@KO no teu código as musicas k keremos vao para um listbox e depois a musica da listbox k estiver selecionada toca, mas quando essa musica acaba n devia começar a tocar a musica abaixo dessa na listbox? alguem me pode ajudar no code para ir reproduzindo as musicas abaixo da musica selecionada k acabou... cumps 🙂 Link to comment Share on other sites More sharing options...
M@KO Posted March 28, 2006 at 12:50 AM Report Share #19776 Posted March 28, 2006 at 12:50 AM oi! desculpa la a demora mas nao conegui por a reproduzir ao sons seguidos directamente da list1 por isso fiz um array onde gravo as musicas ke kero ouvir e a list1 serve so pra ver o ke esta a tocar, tas a ver o filme???? com o mesmo form mete este codigo Dim x, y As Integer Dim lista(99) As String Private Sub Command1_Click() wmp.FileName = (lista(y)) End Sub Private Sub Dir1_Change() File1.Path = Dir1 End Sub Private Sub File1_Click() If x < 100 Then List1.AddItem (Dir1 & "\" & File1) lista(x) = (Dir1 & "\" & File1) x = x + 1 Else MsgBox ("Entao, 99 musicas nao te chega???") End If End Sub Private Sub Form_Load() x = 0 y = 0 Dir1.Path = "C:\" File1.Pattern = "*.mp3" End Sub Private Sub wmp_EndOfStream(ByVal Result As Long) y = y + 1 wmp.FileName = (lista(y)) End Sub Esta soluçao do array tireia dakele exemplo que o d_pintassilgo aqui tem ke tu na conseguiste ver o codigo. cool stuff http://blog.zxcoders.com/ Link to comment Share on other sites More sharing options...
M@KO Posted March 28, 2006 at 03:11 AM Report Share #19777 Posted March 28, 2006 at 03:11 AM Boas noticias 😁 já descobri como ponho a tocar as musicas seguidas diretamente da list1 o codigo fica muito mais simples 😁 novamente com o mesmo form poe este codigo Dim x As Integer Private Sub Command1_Click() wmp.FileName = (List1.List(x)) End Sub Private Sub Dir1_Change() File1.Path = Dir1 End Sub Private Sub File1_Click() List1.AddItem (Dir1 & "\" & File1) End Sub Private Sub Form_Load() x = 0 Dir1.Path = "C:\" File1.Pattern = "*.mp3" End Sub Private Sub wmp_EndOfStream(ByVal Result As Long) x = x + 1 wmp.FileName = (List1.List(x)) End Sub 🙂 cool stuff http://blog.zxcoders.com/ Link to comment Share on other sites More sharing options...
Tiago_22 Posted March 28, 2006 at 06:18 PM Author Report Share #19860 Posted March 28, 2006 at 06:18 PM tks, já esta a funkar 😄 🙂 alguem sabe se da para alterar o skin do objecto windos media player? fikem bem =p cumps 👍 M@ko e vbmaster tem sido uns porreiros 👍 Link to comment Share on other sites More sharing options...
vbmaster Posted March 28, 2006 at 06:33 PM Report Share #19863 Posted March 28, 2006 at 06:33 PM Constrói o tue próprio objecto, tendo por trás as funções dum objecto media player escondido.... 😄 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now