📄 form1.vb
字号:
Option Strict Off
Option Explicit On
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'对于启动窗体,所创建的第一个实例为默认实例。
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
End Sub
'窗体重写处置,以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents Drive2 As Microsoft.VisualBasic.Compatibility.VB6.DirListBox
Public WithEvents Drive1 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
Friend WithEvents DirListBoxArray1 As Microsoft.VisualBasic.Compatibility.VB6.DirListBoxArray
Friend WithEvents DirListBoxArray2 As Microsoft.VisualBasic.Compatibility.VB6.DirListBoxArray
Friend WithEvents Drive3 As Microsoft.VisualBasic.Compatibility.VB6.DriveListBox
'Windows 窗体设计器所必需的
Public ToolTip1 As System.Windows.Forms.ToolTip
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器来修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.DirListBoxArray2 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBoxArray(Me.components)
Me.Drive2 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBox()
Me.Drive1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox()
Me.DirListBoxArray1 = New Microsoft.VisualBasic.Compatibility.VB6.DirListBoxArray(Me.components)
Me.Drive3 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox()
Me.SuspendLayout()
'
'Drive2
'
Me.Drive2.IntegralHeight = False
Me.Drive2.Location = New System.Drawing.Point(184, 72)
Me.Drive2.Name = "Drive2"
Me.Drive2.Size = New System.Drawing.Size(128, 40)
Me.Drive2.TabIndex = 1
'
'Drive1
'
Me.Drive1.BackColor = System.Drawing.SystemColors.Window
Me.Drive1.Cursor = System.Windows.Forms.Cursors.Default
Me.Drive1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.Drive1.DropDownWidth = 217
Me.Drive1.ForeColor = System.Drawing.SystemColors.WindowText
Me.Drive1.Location = New System.Drawing.Point(143, 204)
Me.Drive1.Name = "Drive1"
Me.Drive1.Size = New System.Drawing.Size(217, 22)
Me.Drive1.TabIndex = 0
Me.Drive1.Visible = False
'
'Drive3
'
Me.Drive3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.Drive3.DropDownWidth = 152
Me.Drive3.Location = New System.Drawing.Point(248, 312)
Me.Drive3.Name = "Drive3"
Me.Drive3.Size = New System.Drawing.Size(152, 22)
Me.Drive3.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(584, 375)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Drive3, Me.Drive2, Me.Drive1})
Me.Location = New System.Drawing.Point(4, 29)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
#Region "升级支持"
Private Shared m_vb6FormDefInstance As Form1
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As Form1
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New Form1()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set(ByVal Value As Form1)
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim er As Object
Dim msg As String
Dim start As Object
Dim PauseTime As Object
Dim act As Object
Dim Files As String
Dim cdname As String
Dim drvnmb As Object
'检查光驱是否准备好或光驱中是否为VCD光碟
On Error Goto finderr
startline:
'UPGRADE_WARNING: 未能解析对象 drvnmb 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
drvnmb = Drive3.Items.Count()
'cdname$ = Drive1.List(drvnmb - 1)
'UPGRADE_WARNING: 未能解析对象 drvnmb 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
cdname = Drive3.Items(drvnmb - 1)
'UPGRADE_WARNING: Dir 有一个新行为。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1041.htm
Files = Dir(cdname & "\mpegav\*.dat")
If Files = "" Then Goto finderr
'假定Xmplayer位于该目录,打开并使之获得焦点
'act = Shell("C:\Program Files\Xmplayer\XMPLAYER.EXE", 1)
'UPGRADE_WARNING: 未能解析对象 act 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
act = Shell("C:\Herosoft\Hero2000\STHSVCD.EXE", 5)
'模拟Ctrl+fv键盘动作,开始播放VCD
System.Windows.Forms.SendKeys.SendWait("%(fv),^{home}")
'SendKeys "^{home}", True
'一些VCD光碟因制作不规范,播放前会提示有一些错误,为对这些错误作出处理,
'所以暂停若干秒,此暂停是在后台进行,不影响正常 VCD连续播放
'UPGRADE_WARNING: 未能解析对象 PauseTime 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
PauseTime = 2
'UPGRADE_WARNING: 未能解析对象 start 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
start = Timer
'UPGRADE_WARNING: 未能解析对象 PauseTime 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
'UPGRADE_WARNING: 未能解析对象 start 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
Do While Timer < start + PauseTime
Loop
'模拟其它键盘动作,满屏播放,隐藏面板等
System.Windows.Forms.SendKeys.SendWait("{enter},^s,^p,^{f4},%{esc},^4")
End
finderr:
msg = "光驱未准备好,或光驱中非VCD光盘,将光驱准备好,"
msg = msg & "或换一张光盘,然后回车重试,或按取消退出"
'UPGRADE_WARNING: 未能解析对象 er 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
er = MsgBox(msg, 53, "出错提示")
'UPGRADE_WARNING: 未能解析对象 er 的默认属性。 单击以获得更多信息:ms-help://MS.MSDNVS/vbcon/html/vbup1037.htm
If er = 4 Then
Resume startline
'由用户选择重试或退出
Else : End
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -