📄 form1.frm
字号:
VERSION 5.00
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Begin VB.Form form1
BackColor = &H00FFC0C0&
BorderStyle = 1 'Fixed Single
Caption = "播放光驱内所有VCD节目"
ClientHeight = 2610
ClientLeft = 45
ClientTop = 330
ClientWidth = 4365
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2610
ScaleWidth = 4365
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
BackColor = &H00FF8080&
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 1080
Style = 1 'Graphical
TabIndex = 4
Top = 1845
Width = 2070
End
Begin VB.Timer Timer2
Interval = 3000
Left = 2370
Top = 2175
End
Begin VB.FileListBox File1
Height = 2790
Left = 3150
TabIndex = 3
Top = 1170
Visible = 0 'False
Width = 1560
End
Begin VB.CommandButton Command1
BackColor = &H00FF8080&
Caption = "播放"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 1080
Style = 1 'Graphical
TabIndex = 2
Top = 1305
Width = 2070
End
Begin VB.Timer Timer1
Interval = 3000
Left = 1890
Top = 2040
End
Begin VB.TextBox mci
Height = 300
Left = 3240
TabIndex = 1
Text = "1"
Top = 1320
Visible = 0 'False
Width = 975
End
Begin MCI.MMControl mci1
Height = 420
Left = 435
TabIndex = 0
Top = 270
Width = 3540
_ExtentX = 6244
_ExtentY = 741
_Version = 393216
PrevEnabled = -1 'True
PlayEnabled = -1 'True
PauseEnabled = -1 'True
StepEnabled = -1 'True
StopEnabled = -1 'True
RecordEnabled = -1 'True
Silent = -1 'True
Shareable = -1 'True
DeviceType = ""
FileName = ""
End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_CDROM = 5
Dim CDDRIVE As String
Dim MYSTR As String
Private Sub Form_Load()
For I = 97 To 122 Step 1 '判断光驱盘符
If GetDriveType(Chr(I) & ":\") = DRIVE_CDROM Then
CDDRIVE = GetDriveType(Chr(I) & ":\")
MYSTR = Chr(I) & ":\"
End If
Next I
On Error GoTo ErrorHandler
File1.Path = MYSTR & "MPEGAV" 'vcd光盘播放曲目路径
mci1.Notify = False
mci1.Wait = True
mci1.Command = "stop"
mci1.Command = "close"
mci1.DeviceType = "mpegvideo" '播放格式为VCD格式
File1.ListIndex = 0
mci1.FileName = MYSTR & "MPEGAV\" & File1.FileName '选择第一首歌
mci1.Notify = False
mci1.Wait = True
mci1.Command = "open"
mci1.Notify = True
mci1.Wait = False
mci1.Command = "play" '开始播放
ErrorHandler:
MsgBox ("光驱内没有VCD光盘,请放入VCD光盘!")
End Sub
Private Sub Timer1_Timer()
If mci1.Mode = 525 Then
mci.Text = 3
Else
mci.Text = 8
End If
End Sub
Private Sub Timer2_Timer()
On Error GoTo ErrorHandler
If mci.Text = 3 Then
If File1.ListIndex < File1.ListCount - 1 Then
File1.ListIndex = Val(File1.ListIndex) + 1
mci1.Command = "stop"
mci1.Command = "close"
mci1.DeviceType = "mpegvideo"
mci1.FileName = MYSTR & "MPEGAV\" & File1.FileName
mci1.Notify = False
mci1.Wait = True
mci1.Command = "open"
mci1.Notify = True
mci1.Wait = False
mci1.Command = "play"
End If
If File1.ListIndex = File1.ListCount - 1 Then
mci1.Command = "stop"
mci1.Command = "close"
mci1.DeviceType = "mpegvideo"
File1.ListIndex = 0
mci1.FileName = MYSTR & "MPEGAV\" & File1.FileName
mci1.Notify = False
mci1.Wait = True
mci1.Command = "open"
mci1.Notify = True
mci1.Wait = False
mci1.Command = "play"
End If
End If
ErrorHandler:
MsgBox ("光驱内没有VCD光盘,请放入VCD光盘!")
End Sub
Private Sub Command1_Click()
On Error GoTo ErrorHandler
File1.Path = MYSTR & "MPEGAV"
mci1.Notify = False
mci1.Wait = True
mci1.Command = "stop"
mci1.Command = "close"
mci1.DeviceType = "mpegvideo"
mci1.FileName = File1.FileName
mci1.FileName = MYSTR & "MPEGAV\" & File1.FileName
mci1.Notify = False
mci1.Wait = True
mci1.Command = "open"
mci1.Notify = True
mci1.Wait = False
mci1.Command = "play"
ErrorHandler:
MsgBox ("光驱内没有VCD光盘,请放入VCD光盘!")
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -