请高手进来帮我改下多媒体程序 谢谢了~~
Private Sub Command1_Click()
openfile
End Sub
Private Sub Command2_Click()
MMControl1.Command = "close"
Timer1.Enabled = False
ProgressBar.Value = 1
Label1.Caption = "文件名"
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
MMControl1.Command = "play"
End Sub
Private Sub Command5_Click()
MMControl1.Command = "pause"
End Sub
Private Sub Command6_Click()
MMControl1.Command = "stop"
End Sub
Private Sub Command7_Click()
If Command7.Caption = "循环播放" Then
Command7.Caption = "停止循环"
Timer2.Enabled = True
Else
Command7.Caption = "循环播放"
Timer2.Enabled = False
End If
End Sub
Private Sub Form_Load()
Timer1.Interval = 50
MMControl1.hWndDisplay = 0
CommonDialog1.Filter = "MP3 文件(*.MP3)/*.MP3/CD 音频(*.WAV)/*.WAV/Windows 音频(*.mid)/*.mid/所有文件(*.*)/*.*"
End Sub
Private Sub MMControl1_EjectClick(Cancel As Integer)
openfile
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
ProgressBar1.Value = MMControl1.Position
End Sub
Sub openfile()
Dim msec As Double
MMControl1.UpdateInterval = 0
CommonDialog1.Flags = vbofnreadonly Or vbofnfilemustexist
CommonDialog1.CancelError = True
CommonDialog1.FileName = " "
On Error Resume Next
CommonDialog1.ShowOpen
If Err <> 0 Then
Exit Sub
End If
If Notmmcontrol1.Mode = vbmcimodenotopen Then
MMControl1.Command = "close"
End If
MMControl1.FileName = CommonDialog1.FileName
If MMControl1.FileName = " " Then
Exit Sub
Else
Label1.Caption = MMControl1.FileName
If Right(MMControl1.FileName, 3) = "wav" Then
MMControl1.DeviceType = "waveaudio"
Else
If Right(MMControl1.FileName, 3) = "mid" Then
MMControl1.DeviceType = "sequencer"
End If
MMControl1.DeviceType = " "
End If
End If
On Error GoTo MCI_ERROR
MMControl1.Command = "open"
Timer1.Enabled = True
ProgressBar1.Max = MMControl1.Length
ProgressBar1.Min = 1
On Error GoTo 0
Exit Sub
MCI_ERROR:
Resume mci_exit
mci_exit:
End Sub
Private Sub Timer2_Timer()
If ProgressBar1.Value = ProgressBar1.Max Then
MMControl1.Command = "prev"
MMControl1.Command = "play"
End If
End Sub
[解决办法]
Form_Load开头加上一句 on error resume next
[解决办法]
测了一下没啥问题
/要改成|才有效的!!
CommonDialog1.Filter = "MP3 文件(*.MP3)
[解决办法]
*.MP3
[解决办法]
CD 音频(*.WAV)
------解决方案--------------------
*.WAV
[解决办法]
Windows 音频(*.mid)
[解决办法]
*.mid
[解决办法]
所有文件(*.*)
[解决办法]
*.*"