Private Declare Function PrintWindow Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long, ByVal nFlags As Long) As Long Dim AppDisk$, MusicDisk$, SongNo& Private Sub Form_Load() Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2 AppDisk = IIf(Right(App.Path, 1) = "", App.Path, App.Path & "") MusicDisk = AppDisk & "Music" If Dir(MusicDisk, vbDirectory) = "" Then MkDir MusicDisk List1.AddItem MusicDisk & "1.dat" List1.AddItem MusicDisk & "2.dat" List1.AddItem MusicDisk & "3.dat" SongNo = 1 If Dir(List1.List(0)) <> "" Then WindowsMediaPlayer1.URL = List1.List(0) Timer1.Interval = 100: Timer1.Enabled = True End Sub
Private Sub Timer1_Timer() If WindowsMediaPlayer1.playState = wmppsStopped Or WindowsMediaPlayer1.playState = wmppsReady Then SongNo = IIf(SongNo > 3, 1, SongNo + 1) If Dir(List1.List(SongNo - 1)) = "" Then Exit Sub WindowsMediaPlayer1.URL = List1.List(SongNo - 1) WindowsMediaPlayer1.Controls.play End If End Sub