Dim flag As Boolean
Private Sub Command1_Click()
flag = Not flag
With WindowsMediaPlayer1
If flag Then
Command1.Caption = "暂停"
.Controls.play
Else
Command1.Caption = "播放"
.Controls.pause End If
End With
End Sub
Private Sub Command2_Click() '停止
WindowsMediaPlayer1.Controls.stop
End Sub
Private Sub Command3_Click() '音量减小
WindowsMediaPlayer1.settings.volume = WindowsMediaPlayer1.settings.volume - 10
End Sub
Private Sub Command4_Click() '音量增大
WindowsMediaPlayer1.settings.volume = WindowsMediaPlayer1.settings.volume + 10
End Sub
Private Sub Command5_Click() '打开文件
CommonDialog1.Filter = "音乐文件(*.mp3,*.wav,*.wma)|*.mp3;*.wav;*.wma"
CommonDialog1.ShowOpen
WindowsMediaPlayer1.URL = CommonDialog1.FileName
End Sub
Private Sub Form_Load()
'==================================
'With WindowsMediaPlayer1
'.uiMode = "full"
'End With
'If App.PrevInstance Then
'MsgBox "程序正在运行,请检查窗口是否被最小化"
'End If
'===================================
End Sub
Private Sub Command1_Click()
flag = Not flag
With WindowsMediaPlayer1
If flag Then
Command1.Caption = "暂停"
.Controls.play
Else
Command1.Caption = "播放"
.Controls.pause End If
End With
End Sub
Private Sub Command2_Click() '停止
WindowsMediaPlayer1.Controls.stop
End Sub
Private Sub Command3_Click() '音量减小
WindowsMediaPlayer1.settings.volume = WindowsMediaPlayer1.settings.volume - 10
End Sub
Private Sub Command4_Click() '音量增大
WindowsMediaPlayer1.settings.volume = WindowsMediaPlayer1.settings.volume + 10
End Sub
Private Sub Command5_Click() '打开文件
CommonDialog1.Filter = "音乐文件(*.mp3,*.wav,*.wma)|*.mp3;*.wav;*.wma"
CommonDialog1.ShowOpen
WindowsMediaPlayer1.URL = CommonDialog1.FileName
End Sub
Private Sub Form_Load()
'==================================
'With WindowsMediaPlayer1
'.uiMode = "full"
'End With
'If App.PrevInstance Then
'MsgBox "程序正在运行,请检查窗口是否被最小化"
'End If
'===================================
End Sub