I Have A Music Player I Made Using A Tutorial In Visual basic 2008 And The Play Button For This Player Plays The Songs Fine, But The Problem Is The Code:
Does Not Play The Next Song Imported Into The List Box. So Rather Than Playing Around With That I Figured It Would Be Easier To Have A Button That Will Just Select The Next Item In The List Box (Becuase The Windows Media Player Tool Is Playing Songs Imported Into The List Box) . Unfortunately I Have No Idea how To Do That, So I Was Hoping Someone Could Help me Out?
Also Just Ignore This Part
Thats Just A Universal Hotkey, Which Already Works Fine.
Code:
AxWindowsMediaPlayer1.Ctlcontrols.next()
Code:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub shadows_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim F12key As Boolean
Dim F11key As Boolean
F12key = GetAsyncKeyState(Keys.F12)
F11key = GetAsyncKeyState(Keys.F11)
If F12key = True Then
AxWindowsMediaPlayer1.URL = Listbox1.SelectedItem
End If
If F11key = True Then
AxWindowsMediaPlayer1.Ctlcontrols.stop()
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
OpenFileDialog1.ShowDialog()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxWindowsMediaPlayer1.URL = Listbox1.SelectedItem
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AxWindowsMediaPlayer1.Ctlcontrols.stop()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
AxWindowsMediaPlayer1.Ctlcontrols.pause()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
AxWindowsMediaPlayer1.Ctlcontrols.next()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
AxWindowsMediaPlayer1.Ctlcontrols.previous()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
For Each track As String In OpenFileDialog1.FileNames
Listbox1.Items.Add(track)
Next
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub
End Class
Code:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub shadows_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim F12key As Boolean
Dim F11key As Boolean
F12key = GetAsyncKeyState(Keys.F12)
F11key = GetAsyncKeyState(Keys.F11)
If F12key = True Then
AxWindowsMediaPlayer1.URL = Listbox1.SelectedItem
End If
If F11key = True Then
AxWindowsMediaPlayer1.Ctlcontrols.stop()
End If
End Sub
Comment