form1.frm
来自「好用啊」· FRM 代码 · 共 150 行
FRM
150 行
VERSION 5.00
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 frmMCI
Caption = "MCI"
ClientHeight = 2730
ClientLeft = 60
ClientTop = 345
ClientWidth = 4830
LinkTopic = "Form1"
ScaleHeight = 2730
ScaleWidth = 4830
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 3480
TabIndex = 5
Top = 1800
Width = 735
End
Begin VB.CommandButton cmdClose
Caption = "关闭"
Height = 375
Left = 2400
TabIndex = 4
Top = 1800
Width = 855
End
Begin VB.TextBox txtDisplay
Height = 390
Left = 120
TabIndex = 3
Top = 120
Width = 4575
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 0
Top = 2160
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton cmdPlayStop
Caption = "播放"
Height = 375
Left = 1440
TabIndex = 2
Top = 1800
Width = 855
End
Begin VB.CommandButton cmdOpen
Caption = "打开"
Height = 375
Left = 480
TabIndex = 1
Top = 1800
Width = 855
End
Begin MCI.MMControl MMControl1
Height = 735
Left = 840
TabIndex = 0
Top = 720
Width = 3975
_ExtentX = 7011
_ExtentY = 1296
_Version = 393216
DeviceType = ""
FileName = ""
End
End
Attribute VB_Name = "frmMCI"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim blnPlay As Boolean
Dim strFileName As String
Private Sub Form_Load()
MMControl1.DeviceType = "AVIVideo"
MMControl1.EjectVisible = False
MMControl1.RecordVisible = False
CommonDialog1.Filter = "动画文件(*.avi)|*.avi"
End Sub
Private Sub cmdOpen_Click()
CommonDialog1.FileName = ""
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
MMControl1.Command = "close"
MMControl1.FileName = CommonDialog1.FileName
strFileName = CommonDialog1.FileName
txtDisplay.Text = strFileName
MMControl1.Command = "open"
End If
End Sub
Private Sub cmdPlayStop_Click()
If strFileName = "" Then Exit Sub
If blnPlay Then
MMControl1.Command = "stop"
cmdPlayStop.Caption = "播放"
blnPlay = False
Else
MMControl1.Command = "seek"
MMControl1.Command = "play"
cmdPlayStop.Caption = "停止"
blnPlay = True
End If
End Sub
Private Sub cmdClose_Click()
strFileName = ""
MMControl1.Command = "close"
txtDisplay.Text = ""
End Sub
Private Sub cmdExit_Click()
MMControl1.Command = "close"
Unload Me
End Sub
Private Sub MMControl1_Done(NotifyCode As Integer)
cmdPlayStop.Caption = "播放"
blnPlay = False
End Sub
Private Sub MMControl1_PauseClick(Cancel As Integer)
cmdPlayStop.Caption = "播放"
blnPlay = False
End Sub
'
Private Sub MMControl1_PlayClick(Cancel As Integer)
cmdPlayStop.Caption = "停止"
blnPlay = True
End Sub
Private Sub MMControl1_StopClick(Cancel As Integer)
cmdPlayStop.Caption = "播放"
blnPlay = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
MMControl1.Command = "close"
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?