哪位专家能把这段VB代码注释一下

baizhu986 2008-06-03 09:02:28
Option Strict Off
Option Explicit On
Friend Class form1
Inherits System.Windows.Forms.Form
'窗体重写处置,以清理组件列表。
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
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Command2 As System.Windows.Forms.Button
Public WithEvents Timer2 As System.Windows.Forms.Timer
Public WithEvents File1 As Microsoft.VisualBasic.Compatibility.VB6.FileListBox
Public WithEvents Command1 As System.Windows.Forms.Button
Public WithEvents Timer1 As System.Windows.Forms.Timer
Public WithEvents mci As System.Windows.Forms.TextBox
Public WithEvents mci1 As AxMCI.AxMMControl
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(form1))
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.Command2 = New System.Windows.Forms.Button
Me.Timer2 = New System.Windows.Forms.Timer(Me.components)
Me.File1 = New Microsoft.VisualBasic.Compatibility.VB6.FileListBox
Me.Command1 = New System.Windows.Forms.Button
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.mci = New System.Windows.Forms.TextBox
Me.mci1 = New AxMCI.AxMMControl
CType(Me.mci1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Command2
'
Me.Command2.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.Command2.Cursor = System.Windows.Forms.Cursors.Default
Me.Command2.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Command2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Command2.Location = New System.Drawing.Point(72, 123)
Me.Command2.Name = "Command2"
Me.Command2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Command2.Size = New System.Drawing.Size(138, 32)
Me.Command2.TabIndex = 4
Me.Command2.Text = "退出"
'
'Timer2
'
Me.Timer2.Enabled = True
Me.Timer2.Interval = 3000
'
'File1
'
Me.File1.BackColor = System.Drawing.SystemColors.Window
Me.File1.Cursor = System.Windows.Forms.Cursors.Default
Me.File1.ForeColor = System.Drawing.SystemColors.WindowText
Me.File1.Location = New System.Drawing.Point(210, 78)
Me.File1.Name = "File1"
Me.File1.Pattern = "*.*"
Me.File1.Size = New System.Drawing.Size(104, 184)
Me.File1.TabIndex = 3
Me.File1.Visible = False
'
'Command1
'
Me.Command1.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.Command1.Cursor = System.Windows.Forms.Cursors.Default
Me.Command1.Font = New System.Drawing.Font("宋体", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Command1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Command1.Location = New System.Drawing.Point(72, 87)
Me.Command1.Name = "Command1"
Me.Command1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Command1.Size = New System.Drawing.Size(138, 32)
Me.Command1.TabIndex = 2
Me.Command1.Text = "播放"
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 3000
'
'mci
'
Me.mci.AcceptsReturn = True
Me.mci.AutoSize = False
Me.mci.BackColor = System.Drawing.SystemColors.Window
Me.mci.Cursor = System.Windows.Forms.Cursors.IBeam
Me.mci.ForeColor = System.Drawing.SystemColors.WindowText
Me.mci.Location = New System.Drawing.Point(216, 88)
Me.mci.MaxLength = 0
Me.mci.Name = "mci"
Me.mci.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.mci.Size = New System.Drawing.Size(65, 20)
Me.mci.TabIndex = 1
Me.mci.Text = "1"
Me.mci.Visible = False
'
'mci1
'
Me.mci1.Enabled = True
Me.mci1.Location = New System.Drawing.Point(29, 18)
Me.mci1.Name = "mci1"
Me.mci1.OcxState = CType(resources.GetObject("mci1.OcxState"), System.Windows.Forms.AxHost.State)
Me.mci1.Size = New System.Drawing.Size(236, 28)
Me.mci1.TabIndex = 0
'
'form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(291, 174)
Me.Controls.Add(Me.Command2)
Me.Controls.Add(Me.File1)
Me.Controls.Add(Me.Command1)
Me.Controls.Add(Me.mci)
Me.Controls.Add(Me.mci1)
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Location = New System.Drawing.Point(3, 22)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "form1"
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "播放光驱内所有VCD节目"
CType(Me.mci1, System.ComponentModel.ISupportInitialize).EndInit()
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
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Integer
Private Const DRIVE_CDROM As Short = 5
Dim CDDRIVE As String
Dim MYSTR As String
Private Sub form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim I As Object
For I = 97 To 122 Step 1 '判断光驱盘符

If GetDriveType(Chr(I) & ":\") = DRIVE_CDROM Then

CDDRIVE = CStr(GetDriveType(Chr(I) & ":\"))
keyword="vbup1037"”
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.SelectedIndex = 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_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick
If mci1.Mode = 525 Then
mci.Text = CStr(3)
Else
mci.Text = CStr(8)
End If
End Sub

...全文
110 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuxiaoying 2008-06-08
  • 打赏
  • 举报
回复
这段代码的功能是什么啊
指间的风 2008-06-04
  • 打赏
  • 举报
回复
很长,但是看了一下,没有什么难的部分。
都是一些简单的属性的设置和方法的调用。
LZ去找下Msdn把看不懂的地方查找一下吧。
ejoe313 2008-06-04
  • 打赏
  • 举报
回复
是啊,这么一大段都注释吗?
Fireman_duck 2008-06-04
  • 打赏
  • 举报
回复
给米不给?不给谁干呀!
weilu0328 2008-06-04
  • 打赏
  • 举报
回复
帮楼主顶了.
cd0425 2008-06-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 yanlongwuhui 的回复:]
哪几句不明白,需要注释的?不会全部注释下吧
[/Quote]
yanlongwuhui 2008-06-04
  • 打赏
  • 举报
回复
哪几句不明白,需要注释的?不会全部注释下吧

16,718

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧