【VB开源代码栏目提醒】:网学会员为需要VB开源代码的朋友们搜集整理了多媒体播放器.frm相关资料,希望对各位网友有所帮助!
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "多媒体播放器"
ClientHeight = 2415
ClientLeft = 1965
ClientTop = 5310
ClientWidth = 6300
Icon = "多媒体播放器.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "多媒体播放器.frx":000C
ScaleHeight = 2415
ScaleWidth = 6300
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5400
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 2
Top = 2040
Visible = 0 'False
Width = 6300
_ExtentX = 11113
_ExtentY = 661
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin MSComctlLib.Slider Slider1
Height = 375
Left = 480
TabIndex = 1
Top = 960
Width = 5295
_ExtentX = 9340
_ExtentY = 661
_Version = 393216
End
Begin MCI.MMControl MMControl1
Height = 375
Left = 240
TabIndex = 0
Top = 480
Width = 420
_ExtentX = 741
_ExtentY = 661
_Version = 393216
Frames = 5
PrevVisible = 0 'False
NextVisible = 0 'False
PauseVisible = 0 'False
BackVisible = 0 'False
StepVisible = 0 'False
StopVisible = 0 'False
RecordVisible = 0 'False
EjectVisible = 0 'False
DeviceType = ""
FileName = ""
End
Begin VB.Menu Files
Caption = "文件(&F)"
Begin VB.Menu Open
Caption = "选择歌曲(&S)"
Shortcut = ^S
End
Begin VB.Menu Play
Caption = "播放VCD(&P)"
Shortcut = ^P
End
Begin
VB.Menu fd
Caption = "-"
End
Begin VB.Menu Exit
Caption = "退出(&E)"
Shortcut = ^E
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'退出事件
Private Sub Exit_Click()
MMControl1.Command = "Stop" '停止
MMControl1.Command = "Close" '关闭
Unload Form2 '卸载窗体Form2
Set Form2 = Nothing '设置窗体Form2为空
Unload Me '卸载当前窗体
Set Form1 = Nothing '设置当前窗体为空
End Sub
Private Sub Form_Unload(Cancel As Integer)
MMControl1.Command = "Stop" '停止
MMControl1.Command = "Close" '关闭
Unload Form2 '卸载窗体Form2
Set Form2 = Nothing '设置窗体Form2为空
Unload Me '卸载当前窗体
Set Form1 = Nothing '设置当前窗体为空
End Sub
'播放事件
Private Sub MMControl1_PlayClick(Cancel As Integer)
MMControl1.Command = "Play" '播放
Form2.Caption = "开始播放" '提示信息
End Sub
'播放器控件的状态更新事件
Private Sub MMControl1_StatusUpdate()
With MMControl1
Select Case CommonDialog1.FilterIndex
Case 1
StatusBar1.SimpleText = "当前幀数" & .Position '设置状态栏中的内容
Slider1.Value = .Position '设置滑动条的值
Case 2
StatusBar1.SimpleText = "声音长度" & .Position '设置状态栏中的内容
Slider1.Max = .Length
Slider1.Value = .Position '设置滑动条的值
Case 3
Slider1.Value = .Position '设置滑动条的值
StatusBar1.SimpleText = "当前幀数" & .Position '设置状态栏中的内容
Case 4
StatusBar1.SimpleText = "MIDI长度" & .Position '设置状态栏中的内容
Slider1.Max = .Length
Slider1.Value = .Position '设置滑动条的值
End Select
If .Position = .Length Then
.Command = "Prev" '后退
.Command = "Pause" '暂停
End If
End With
End Sub
'打开事件
Private Sub Open_Click()
Dim Temp As Byte '定义字节类型变量
With CommonDialog1
.FileName = "" '设置文件路径初始值
.Filter = "(*.Avi)|*.Avi|(*.Wave)|*.Wav|(Vcd*.Dat)|*.Dat|(Midi*.Mid)|*.Mid" '设置文件类型
.FilterIndex = 3 '设置类型索引值
.DialogTitle = "请选择歌曲" '设置对话框标题
.Action = 1
If .FileName = "" Then
Temp = MsgBox("你还没有选择歌曲", 37, "对不起") '提示信息
If Temp = vbRetry Then
.ShowOpen '设置打开状态
If .FileName = "" Then Exit Sub '退出过程
Else
Exit Sub '退出过程
End If
End If
Select Case .FilterIndex
Case 1
Load Form2 '加载窗体Form2
Form2.Caption = "准备就绪" '设置窗体Form2的标题
Form2.Show '显示窗体Form2
StatusBar1.Visible = True '使得工具栏可见
MMControl1.DeviceType = "AviVideo" '设置播放器类型
MMControl1.TimeFormat = 3 '设置播放的时间格式
MMControl1.FileName = .FileName '获得文件路径名
MMControl1.Command = "Open" '设置打开命令
Slider1.Min = 0 '设置滑动条控件的最小值
Slider1.Max = MMControl1.Length '设置滑动条控件的最小值
MMContr