mainform.frm
上传用户:dohkov
上传日期:2007-06-18
资源大小:35k
文件大小:32k
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
- Begin VB.Form MainForm
- Caption = "光盘管家 1.01"
- ClientHeight = 5265
- ClientLeft = 165
- ClientTop = 450
- ClientWidth = 8085
- Icon = "mainform.frx":0000
- LinkTopic = "Form1"
- ScaleHeight = 5265
- ScaleWidth = 8085
- StartUpPosition = 3 '窗口缺省
- Begin VB.PictureBox Picture1
- Height = 4335
- Left = 2160
- MousePointer = 9 'Size W E
- ScaleHeight = 4335
- ScaleWidth = 45
- TabIndex = 2
- Top = 840
- Width = 50
- End
- Begin RichTextLib.RichTextBox RichTextBox1
- Height = 1000
- Left = 2280
- TabIndex = 6
- Top = 3840
- Width = 5655
- _ExtentX = 9975
- _ExtentY = 1773
- _Version = 393217
- Enabled = -1 'True
- ReadOnly = -1 'True
- ScrollBars = 3
- TextRTF = $"mainform.frx":0442
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9.75
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin MSComctlLib.Toolbar Toolbar1
- Align = 1 'Align Top
- Height = 510
- Left = 0
- TabIndex = 3
- Top = 0
- Width = 8085
- _ExtentX = 14261
- _ExtentY = 900
- ButtonWidth = 1138
- ButtonHeight = 847
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 10
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "增加"
- Key = "add"
- Object.ToolTipText = "增加一张新的光盘"
- ImageIndex = 4
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查找"
- Key = "find"
- Object.ToolTipText = "查找文件夹或文件"
- ImageIndex = 5
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "备份"
- Key = "backup"
- Object.ToolTipText = "将光盘库备份至软盘或硬盘"
- ImageIndex = 6
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "恢复"
- Key = "restore"
- Object.ToolTipText = "从软盘或硬盘中读入光盘库"
- ImageIndex = 7
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = " 帮助 "
- Key = "help"
- ImageIndex = 8
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.ImageList ImageList1
- Left = 6600
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 13
- ImageHeight = 13
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 10
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":06CC
- Key = ""
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":0B20
- Key = ""
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":0C1C
- Key = ""
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":0D18
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":0E2C
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":0F40
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":1394
- Key = ""
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":17E8
- Key = ""
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":18FC
- Key = ""
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "mainform.frx":1D50
- Key = ""
- EndProperty
- EndProperty
- End
- End
- Begin MSComctlLib.TreeView TreeView2
- Height = 2775
- Left = 2280
- TabIndex = 1
- Top = 840
- Width = 5655
- _ExtentX = 9975
- _ExtentY = 4895
- _Version = 393217
- HideSelection = 0 'False
- Indentation = 529
- LabelEdit = 1
- LineStyle = 1
- Style = 7
- ImageList = "ImageList1"
- Appearance = 1
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin MSComctlLib.TreeView TreeView1
- Height = 4575
- Left = 0
- TabIndex = 0
- Top = 720
- Width = 2175
- _ExtentX = 3836
- _ExtentY = 8070
- _Version = 393217
- HideSelection = 0 'False
- Indentation = 529
- LabelEdit = 1
- LineStyle = 1
- Style = 7
- ImageList = "ImageList1"
- BorderStyle = 1
- Appearance = 1
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "光盘描述"
- Height = 180
- Left = 2280
- TabIndex = 5
- Top = 3650
- Width = 720
- End
- Begin VB.Label Label1
- Caption = "文件列表框"
- Height = 180
- Left = 2280
- TabIndex = 4
- Top = 600
- Width = 5820
- End
- Begin VB.Menu mnuStyleRightButtonMenu
- Caption = "分类右键菜单"
- Visible = 0 'False
- Begin VB.Menu mnuStyleFind
- Caption = "查找..."
- End
- Begin VB.Menu mnuAddStyle
- Caption = "增加类别"
- End
- Begin VB.Menu mnuDeleteStyle
- Caption = "删除类别"
- End
- Begin VB.Menu mnuRenameStyle
- Caption = "重命名类别"
- End
- End
- Begin VB.Menu mnuCdromRightButtonMenu
- Caption = "光盘右键菜单"
- Visible = 0 'False
- Begin VB.Menu mnuCdromFind
- Caption = "查找..."
- End
- Begin VB.Menu mnuAddCdrom
- Caption = "增加光盘"
- End
- Begin VB.Menu mnuDeleteCdrom
- Caption = "删除光盘"
- End
- Begin VB.Menu mnuRenameCdrom
- Caption = "重命名光盘"
- End
- Begin VB.Menu mnuCdromMove
- Caption = "移至..."
- End
- Begin VB.Menu mnuCdromEditMx
- Caption = "修改描述文本"
- End
- End
- Begin VB.Menu mnuFindResult
- Caption = "查找结果"
- Visible = 0 'False
- Begin VB.Menu mnuFindResultDelete
- Caption = "删除查找结果"
- End
- End
- End
- Attribute VB_Name = "MainForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public CdromText As String
- Public bMouseDown As Boolean
- Private Sub Form_Load()
- CencerForm Me
- TreeView1.Top = Toolbar1.Height + 10
- TreeView1.Left = 10
- Label2.Top = 520 + Label1.Height + TreeView2.Height + 100
- RichTextBox1.Top = 520 + Label1.Height + TreeView2.Height + Label2.Height + 300
- Picture1.Left = TreeView1.Width
- Picture1.Top = TreeView1.Top
- TreeView2.Left = TreeView1.Width + Picture1.Width
- Label1.Left = TreeView2.Left
- RichTextBox1.Left = TreeView2.Left
- Label2.Left = TreeView2.Left
- bMouseDown = False
- TreeView1.Nodes.Add , , "光盘库", "光盘库", 9
- Open "cdrom.cds" For Input As #1
- Do While Not EOF(1)
- Line Input #1, cdroms
- If Left(cdroms, 3) = "光盘库" Then
- TreeView1.Nodes.Add "光盘库", tvwChild, cdroms, Mid(cdroms, 4), 3, 2
- End If
- If Left(cdroms, 3) = "子光盘" Then
- Dim Pos As Single
- Dim SubCdromName As String, CdromStyle As String
- Pos = InStr(1, cdroms, "@@@@@***##")
- If Pos > 0 Then
- Pos = Pos + 10
- SubCdromName = Mid(cdroms, Pos)
- CdromStyle = Mid(cdroms, 4, Pos - 14)
- Set nox = TreeView1.Nodes.Add(CdromStyle, tvwChild, "子光盘" + CdromStyle + "@@@@@***##" + SubCdromName, SubCdromName)
- nox.Image = 1
- End If
- End If
- skey = "@@@@@***##查找结果@@@@@***##"
- If cdroms = skey Then
- TreeView1.Nodes.Add , , cdroms, "查找结果", 5
- End If
- If Left(cdroms, 24) = skey And Len(cdroms) > 24 Then
- TreeView1.Nodes.Add skey, tvwChild, cdroms, Mid(cdroms, 25), 1
- End If
- Loop
- Close 1
- TreeView1.Nodes(1).Expanded = True
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- If UnloadMode = 2 Or UnloadMode = 3 Then
- WriteToDisk
- MsgBox "不能这样退出程序,会造成数据文件的丢失!", vbCritical
- Cancel = True
- Exit Sub
- End If
- If vbYes = MsgBox("是否真的要退出?", vbQuestion + vbYesNo) Then
- WriteToDisk
- Cancel = False
- Else
- Cancel = True
- End If
- End Sub
- Private Sub Form_Resize()
- If Me.WindowState <> 1 Then
- If Me.Width - TreeView1.Left - TreeView1.Width - Picture1.Width - 180 > 1800 Then
- TreeView2.Width = Me.Width - TreeView1.Left - TreeView1.Width - Picture1.Width - 130
- Label1.Width = TreeView2.Width
- RichTextBox1.Width = TreeView2.Width
- Else
- TreeView2.Width = 1800
- Label1.Width = 1800
- Me.Width = TreeView1.Width + TreeView1.Left + Picture1.Width + TreeView2.Width + 130
- RichTextBox1.Width = 1800
- End If
- If Me.Height - 2000 < 1800 Then
- Me.Height = 2000 + 1800
- End If
- TreeView1.Height = Me.Height - 520 - 475
- TreeView2.Height = TreeView1.Height - RichTextBox1.Height - Label2.Height - Label1.Height - 220
- Picture1.Height = TreeView1.Height
- Label2.Top = 520 + Label1.Height + TreeView2.Height + 200
- RichTextBox1.Top = 520 + Label1.Height + TreeView2.Height + Label2.Height + 250
- End If
- End Sub
- Private Sub mnuAddCdrom_Click()
- If TreeView1.Nodes(1).Children <= 0 Then
- MsgBox "没有光盘类别,请先添加光盘类别!", vbExclamation
- Exit Sub
- End If
- reinput:
- CdromName = InputBox("请给要新增的光盘取个名:" + Chr(13) + Chr(13) + "(一般为光盘正面的标签文字,以方便查找!)")
- CdromName = Trim(CdromName)
- If Trim(CdromName) <> "" Then
- For i = 1 To TreeView1.Nodes.Count
- If Left(TreeView1.Nodes(i).Key, 24) <> "@@@@@***##查找结果@@@@@***##" Then
- If Trim(CdromName) = TreeView1.Nodes.Item(i) Then
- MsgBox "光盘 " + Chr(34) + CdromName + Chr(34) + " 已存在光盘库中" + Chr(13) + Chr(13) + "请重新输入光盘名或按<取消>结束!", vbExclamation
- GoTo reinput
- End If
- End If
- Next
- Load AddCdrom
- AddCdrom.Show vbModal
- WriteToDisk
- End If
- End Sub
- Private Sub mnuAddStyle_Click()
- reinput:
- Dim AddStyle As String
- AddStyle = InputBox("请输入新增加的类别名:")
- If Trim(AddStyle) <> "" Then
- For i = 1 To TreeView1.Nodes.Count
- If Left(TreeView1.Nodes(i).Key, 24) <> "@@@@@***##查找结果@@@@@***##" Then
- If Trim(AddStyle) = TreeView1.Nodes.Item(i).Text Then
- MsgBox "光盘库中已有类别或光盘 " + Chr(34) + AddStyle + Chr(34) + Chr(13) + Chr(13) + "请重新输入类别名,或按<取消>结束!", vbExclamation
- GoTo reinput
- End If
- End If
- Next
- Set nox = TreeView1.Nodes.Add("光盘库", tvwChild, "光盘库" + Trim(AddStyle), Trim(AddStyle))
- nox.Image = 3
- WriteToDisk
- End If
- End Sub
- Private Sub mnuCdromEditMx_Click()
- CdromText = RichTextBox1.Text
- RichTextBox1.Locked = False
- RichTextBox1.SetFocus
- End Sub
- Private Sub mnuCdromFind_Click()
- Info = "(" + TreeView1.SelectedItem.Parent.Text + ") " + TreeView1.SelectedItem.Text
- CdromName = TreeView1.SelectedItem.Text
- Load Find
- Find.Show vbModal
- WriteToDisk
- End Sub
- Private Sub mnuCdromMove_Click()
- If TreeView1.Nodes(1).Children > 1 Then
- Load CdromRemoveTo
- CdromRemoveTo.Show vbModal
- WriteToDisk
- Else
- MsgBox "没有其它类别供移动!", vbExclamation
- End If
- End Sub
- Private Sub mnuDeleteCdrom_Click()
- If vbYes = MsgBox("是否真的要删除光盘 " + Chr(34) + TreeView1.SelectedItem + Chr(34), vbQuestion + vbYesNo) Then
- DeleteCdrom
- End If
- End Sub
- Private Sub mnuDeleteStyle_Click()
- If TreeView1.SelectedItem.Text <> "光盘库" Then
- If vbYes = MsgBox("是否真的要删除类别 " + Chr(34) + TreeView1.SelectedItem + Chr(34), vbQuestion + vbYesNo) Then
- For i = 2 To TreeView1.Nodes.Count
- If TreeView1.Nodes.Item(i).Key = TreeView1.SelectedItem.Key Then
- Exit For
- End If
- Next
- If TreeView1.Nodes(i).Children > 0 Then
- Set nox = TreeView1.Nodes(i).Child
- For j = 1 To TreeView1.Nodes(i).Children
- If Dir(nox.Text + ".cdo") <> "" Then
- Kill nox.Text + ".cdo"
- End If
- If Dir(nox.Text + ".mx") <> "" Then
- Kill nox.Text + ".mx"
- End If
- Set nox = nox.Next
- Next
- End If
- TreeView1.Nodes.Remove i
- TreeView2.Nodes.Clear
- WriteToDisk
- RichTextBox1.Text = ""
- End If
- Else
- MsgBox "不能删除主键 " + Chr(34) + "光盘库" + Chr(34), vbExclamation
- End If
- End Sub
- Private Sub mnuFindResultDelete_Click()
- If vbNo = MsgBox("是否要删除 " + Mid(mnuFindResultDelete.Caption, 3) + " ", vbQuestion + vbYesNo) Then
- Exit Sub
- End If
- mykey = "@@@@@***##查找结果@@@@@***##"
- If Left(TreeView1.SelectedItem.Key, 24) = mykey And Len(TreeView1.SelectedItem.Key) > 24 Then
- If Dir(TreeView1.SelectedItem.Text + ".fnd") <> "" Then
- Kill TreeView1.SelectedItem.Text + ".fnd"
- End If
- For i = 1 To TreeView1.Nodes.Count
- If TreeView1.Nodes(i).Key = TreeView1.SelectedItem.Key Then
- TreeView1.Nodes.Remove i
- TreeView2.Nodes.Clear
- Exit For
- End If
- Next
- WriteToDisk
- Exit Sub
- End If
- If TreeView1.SelectedItem.Key = mykey Then
- sfiles = Dir("*.fnd")
- Do While sfiles <> ""
- Kill sfiles
- sfiles = Dir
- Loop
- End If
- For i = 1 To TreeView1.Nodes.Count
- If TreeView1.Nodes(i).Key = mykey Then
- TreeView1.Nodes.Remove i
- TreeView2.Nodes.Clear
- MainForm.Toolbar1.Buttons("find").Enabled = True
- Exit For
- End If
- Next
- WriteToDisk
- End Sub
- Private Sub mnuRenameCdrom_Click()
- reinput:
- Dim RenameCdrom As String
- RenameCdrom = InputBox("光盘 " + Chr(34) + TreeView1.SelectedItem.Text + Chr(34) + " 重命名为:", , TreeView1.SelectedItem.Text)
- If Trim(RenameCdrom) <> "" Then
- For i = 1 To TreeView1.Nodes.Count
- If Left(TreeView1.Nodes(i).Key, 24) <> "@@@@@***##查找结果@@@@@***##" Then
- If Trim(RenameCdrom) = TreeView1.Nodes.Item(i).Text Then
- MsgBox "光盘库中已有光盘或类别 " + Chr(34) + RenameCdrom + Chr(34) + Chr(13) + Chr(13) + "请重新输入光盘名!或按<取消>结束", vbExclamation
- GoTo reinput
- End If
- End If
- Next
- If Dir(RenameCdrom + ".cdo") <> "" Then
- If vbNo = MsgBox("光盘镜像文件 " + RenameCdrom + " 已存在!是否真的要覆盖?", vbYesNo + vbQuestion) Then
- Exit Sub
- End If
- Kill RenameCdrom + ".cdo"
- End If
- If Dir(RenameCdrom + ".mx") <> "" Then
- Kill RenameCdrom + ".mx"
- End If
- If Dir(TreeView1.SelectedItem.Text + ".cdo") <> "" Then
- Name TreeView1.SelectedItem.Text + ".cdo" As RenameCdrom + ".cdo"
- End If
-
- If Dir(TreeView1.SelectedItem.Text + ".mx") <> "" Then
- Name TreeView1.SelectedItem.Text + ".mx" As RenameCdrom + ".mx"
- End If
- TreeView1.SelectedItem.Text = Trim(RenameCdrom)
- TreeView1.SelectedItem.Key = "子光盘" + TreeView1.SelectedItem.Parent.Key + "@@@@@***##" + Trim(RenameCdrom)
- WriteToDisk
- End If
- End Sub
- Private Sub mnuRenameStyle_Click()
- If TreeView1.SelectedItem.Text <> "光盘库" Then
- reinput:
- Dim RenameStyle As String
- RenameStyle = InputBox("类别 " + Chr(34) + TreeView1.SelectedItem.Text + Chr(34) + " 重命名为:", , TreeView1.SelectedItem.Text)
- If Trim(RenameStyle) <> "" Then
- For i = 1 To TreeView1.Nodes.Count
- If Left(TreeView1.Nodes(i).Key, 24) <> "@@@@@***##查找结果@@@@@***##" Then
- If Trim(RenameStyle) = TreeView1.Nodes.Item(i) Then
- MsgBox "光盘库中已有类别或光盘 " + Chr(34) + RenameStyle + Chr(34) + Chr(13) + Chr(13) + "请重新输入类别名!或按<取消>结束", vbExclamation
- GoTo reinput
- End If
- End If
- Next
- Set nox = TreeView1.SelectedItem.Child
- For i = 1 To TreeView1.SelectedItem.Children
- nox.Key = "子光盘光盘库" + RenameStyle + "@@@@@***##" + nox.Text
- Set nox = nox.Next
- Next
- TreeView1.SelectedItem.Text = Trim(RenameStyle)
- TreeView1.SelectedItem.Key = "光盘库" + Trim(RenameStyle)
- WriteToDisk
- End If
- Else
- MsgBox "不能重命名主键 " + Chr(34) + "光盘库" + Chr(34), vbExclamation
- End If
- End Sub
- Private Sub mnuStyleFind_Click()
- If TreeView1.SelectedItem.Text = "光盘库" Then
- havecdrom = False
- Dim noddx As Node
- Set noddx = TreeView1.SelectedItem.Child
- For i = 1 To TreeView1.SelectedItem.Children
- If noddx.Children Then
- havecdrom = True
- Exit For
- End If
- Set noddx = noddx.Next
- Next
- If havecdrom Then
- CdromName = "光盘库"
- Info = "整个光盘库"
- Else
- MsgBox "整个光盘库中没有光盘,用不着查找!", vbInformation
- Exit Sub
- End If
- Else
- If TreeView1.SelectedItem.Parent.Text = "光盘库" Then
- If TreeView1.SelectedItem.Children < 1 Then
- MsgBox "类别(" + TreeView1.SelectedItem.Text + ")中没有光盘,用不着查找!", vbInformation
- Exit Sub
- End If
- Info = "类别 (" + TreeView1.SelectedItem.Text + ")"
- CdromName = TreeView1.SelectedItem.Text
- End If
- End If
- Load Find
- Find.Show vbModal
- WriteToDisk
- End Sub
- Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- bMouseDown = True
- End Sub
- Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If bMouseDown Then
- Me.Picture1.Move Me.Picture1.Left + X
- End If
- End Sub
- Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- bMouseDown = False
- If Me.Picture1.Left < 1500 Then
- Me.Picture1.Left = 1500
- End If
- If Me.Picture1.Left > Me.Width - 1680 Then
- Me.Picture1.Left = Me.Width - 1680
- End If
- TreeView1.Width = Me.Picture1.Left
- TreeView2.Left = Picture1.Left + Picture1.Width
- Label1.Left = TreeView2.Left
- Label2.Left = Label1.Left
- RichTextBox1.Left = Label1.Left
- TreeView2.Width = Me.Width - TreeView1.Left - TreeView1.Width - Picture1.Width - 180
- RichTextBox1.Width = TreeView2.Width
- End Sub
- Private Sub richtextbox1_LostFocus()
- If RichTextBox1.Text <> CdromText Then
- If RichTextBox1.Locked = False Then
- If vbNo = MsgBox("描述文本已修改,是否保存新描述文本!", vbQuestion + vbYesNo) Then
- RichTextBox1.Text = CdromText
- End If
- RichTextBox1.Locked = True
- RichTextBox1.SaveFile TreeView1.SelectedItem.Text + ".mx"
- End If
- End If
- End Sub
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "backup"
- Load Backup2
- Backup2.Show vbModal
- Case "restore"
- Load Restore
- Restore.Show vbModal
- Case "add"
- mnuAddCdrom_Click
- Case "help"
- Load frmAbout
- frmAbout.Show vbModal
- Case "find"
- If TreeView1.SelectedItem.Text = "光盘库" Then
- havecdrom = False
- Dim nodddx As Node
- Set nodddx = TreeView1.SelectedItem.Child
- For i = 1 To TreeView1.SelectedItem.Children
- If nodddx.Children Then
- havecdrom = True
- Exit For
- End If
- Set nodddx = nodddx.Next
- Next
- If havecdrom Then
- CdromName = "光盘库"
- Info = "整个光盘库"
- Else
- MsgBox "整个光盘库中没有光盘,用不着查找!", vbInformation
- Exit Sub
- End If
- Else
- If TreeView1.SelectedItem.Parent.Text = "光盘库" Then
- If TreeView1.SelectedItem.Children < 1 Then
- MsgBox "类别(" + TreeView1.SelectedItem.Text + ")中没有光盘,用不着查找!", vbInformation
- Exit Sub
- End If
- CdromName = TreeView1.SelectedItem.Text
- Info = "类别 (" + TreeView1.SelectedItem.Text + ")"
- Else
- CdromName = TreeView1.SelectedItem.Text
- Info = "(" + TreeView1.SelectedItem.Parent.Text + ") " + TreeView1.SelectedItem.Text
- End If
- End If
- Load Find
- Find.Show vbModal
- WriteToDisk
- End Select
- End Sub
- Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- If Button = vbRightButton Then
- If TreeView1.SelectedItem.Key = "@@@@@***##查找结果@@@@@***##" Then
- mnuFindResultDelete.Caption = "删除 查找结果"
- PopupMenu mnuFindResult
- Exit Sub
- End If
- If Left(TreeView1.SelectedItem.Key, 24) = "@@@@@***##查找结果@@@@@***##" And Len(TreeView1.SelectedItem.Key) > 24 Then
- mnuFindResultDelete.Caption = "删除光盘 " + TreeView1.SelectedItem.Text + " 的查找结果"
- PopupMenu mnuFindResult
- Else
- If TreeView1.SelectedItem.Key = "光盘库" Then
- mnuDeleteStyle.Enabled = False
- mnuRenameStyle.Enabled = False
- PopupMenu mnuStyleRightButtonMenu
- Exit Sub
- End If
- If TreeView1.SelectedItem.Parent.Key = "光盘库" Then
- mnuDeleteStyle.Enabled = True
- mnuRenameStyle.Enabled = True
- PopupMenu mnuStyleRightButtonMenu
- Else
- PopupMenu mnuCdromRightButtonMenu
- End If
- End If
- End If
- End Sub
- Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
- '单击查找结果
- If Node.Key = "@@@@@***##查找结果@@@@@***##" Then
- Label1.Caption = "查找结果"
- Node.Expanded = True
- TreeView2.Nodes.Clear
- Toolbar1.Buttons("find").Enabled = False
- RichTextBox1.Text = "请选择一个光盘看查找结果"
- Exit Sub
- End If
- '单击查找结果的某一张光盘
- If Left(Node.Key, 24) = "@@@@@***##查找结果@@@@@***##" Then
- Toolbar1.Buttons("find").Enabled = False
- nodetext = Node.Text + ".fnd"
- If Dir(nodetext) = "" Then
- MsgBox "光盘 " + Chr(34) + Node.Text + Chr(34) + " 查找结果文件丢失,请重新生成!", vbCritical
- For i = 2 To TreeView1.Nodes.Count
- If TreeView1.Nodes.Item(i).Key = TreeView1.SelectedItem.Key Then
- Exit For
- End If
- Next
- RichTextBox1.Text = ""
- TreeView1.Nodes.Remove i
- TreeView2.Nodes.Clear
- WriteToDisk
- Exit Sub
- Else
- Dim FileNotes As String
- fnum = FreeFile
- Open nodetext For Input As #fnum
- Line Input #fnum, FileNotes
- sFindString = FileNotes
- Label1.Caption = "正在读取光盘 (" + TreeView1.SelectedItem.Text + ")" + " 查找 " + Chr(34) + sFindString + Chr(34) + " 后的结果镜像文件..."
- Me.MousePointer = 11
- TreeView2.Nodes.Clear
- Line Input #fnum, FileNotes
- TreeView2.Nodes.Add , , FileNotes, FileNotes, 1
- '把文件写入NODES中
- Do While Not EOF(fnum)
- Line Input #fnum, FileNotes
- If Right(FileNotes, 1) = "" Then
- fns1 = Left(FileNotes, Len(FileNotes) - 1)
- For i = Len(fns1) To 1 Step -1
- If Mid(fns1, i, 1) = "" Then
- FnsPath = Left(fns1, i)
- FnsName = Mid(fns1, i + 1)
- Exit For
- End If
- Next
- TreeView2.Nodes.Add FnsPath, tvwChild, FileNotes, FnsName, 3, 2
- Else
- For i = Len(FileNotes) To 1 Step -1
- If Mid(FileNotes, i, 1) = "" Then
- FnsPath = Left(FileNotes, i)
- FnsName = Mid(FileNotes, i + 1)
- Exit For
- End If
- Next
- TreeView2.Nodes.Add FnsPath, tvwChild, FileNotes, FnsName, 10
- End If
- Loop
- Close fnum
- RichTextBox1.Text = ""
- TreeView2.Nodes(1).Expanded = True
- Label1.Caption = "光盘 (" + TreeView1.SelectedItem.Text + ")" + " 查找 " + Chr(34) + sFindString + Chr(34) + " 后的结果"
- RichTextBox1.Text = Label1.Caption
- Me.MousePointer = 0
- Exit Sub
- End If
- End If
- '单击光盘库
- If Node.Text = "光盘库" Then
- Toolbar1.Buttons("find").Enabled = True
- TreeView2.Nodes.Clear
- Node.Expanded = True
- Label1.Caption = "整个光盘库"
- RichTextBox1.Text = "感谢使用 忠霖软件创作室 的产品"
- TreeView2.Nodes.Clear
- Exit Sub
- End If
- '单击了类别
- If Node.Parent.Text = "光盘库" Then
- Toolbar1.Buttons("find").Enabled = True
- Label1.Caption = "类别(" + Node.Text + ")"
- RichTextBox1.Text = "感谢使用 忠霖软件创作室 的产品"
- TreeView2.Nodes.Clear
- Exit Sub
- Else
- Toolbar1.Buttons("find").Enabled = True
- nodetext = Node.Text + ".cdo"
- If Dir(nodetext) = "" Then
- MsgBox "光盘 " + Chr(34) + Node.Text + Chr(34) + " 镜像文件丢失,请重新生成!", vbCritical
- DeleteCdrom
- Exit Sub
- Else
- fnum = FreeFile
- Open nodetext For Input As #fnum
- Line Input #fnum, FileNotes
- If FileNotes <> "@@@@@***##光盘镜像文件@@@@@***##" Then
- MsgBox "非法的光盘镜像文件 " + Chr(34) + Node.Text + Chr(34) + Chr(13) + Chr(13) + "请重新生成光盘镜像文件!", vbCritical
- DeleteCdrom
- Exit Sub
- Else
- Label1.Caption = "正在读取光盘 " + Chr(34) + Node.Text + Chr(34) + " 的镜像文件......"
- Me.Refresh
- Me.MousePointer = 11
- TreeView2.Nodes.Clear
- Line Input #fnum, FileNotes
- TreeView2.Nodes.Add , , FileNotes, FileNotes, 1
- Do While Not EOF(fnum)
- Line Input #fnum, FileNotes
- If Right(FileNotes, 1) = "" Then
- fns1 = Left(FileNotes, Len(FileNotes) - 1)
- For i = Len(fns1) To 1 Step -1
- If Mid(fns1, i, 1) = "" Then
- FnsPath = Left(fns1, i)
- FnsName = Mid(fns1, i + 1)
- Exit For
- End If
- Next
- TreeView2.Nodes.Add FnsPath, tvwChild, FileNotes, FnsName, 3, 2
- Else
- For i = Len(FileNotes) To 1 Step -1
- If Mid(FileNotes, i, 1) = "" Then
- FnsPath = Left(FileNotes, i)
- FnsName = Mid(FileNotes, i + 1)
- Exit For
- End If
- Next
- TreeView2.Nodes.Add FnsPath, tvwChild, FileNotes, FnsName, 10
- End If
- Loop
- Close fnum
- RichTextBox1.Text = ""
- If Left(Node.Key, 24) <> "@@@@@***##查找结果@@@@@***##" Then
- If Dir(Node.Text + ".mx") <> "" Then
- RichTextBox1.LoadFile Node.Text + ".mx"
- End If
- End If
- TreeView2.Nodes(1).Expanded = True
- Label1.Caption = TreeView1.SelectedItem.Parent.Text + " (" + TreeView1.SelectedItem.Text + ") 中的文件夹与文件"
- Me.MousePointer = 0
- End If
- End If
- End If
- End Sub
- Public Sub WriteToDisk()
- Close
- fnum = FreeFile
- Open "cdrom.cds" For Output As #fnum
- For i = 2 To TreeView1.Nodes.Count
- Print #fnum, TreeView1.Nodes.Item(i).Key
- Next
- Close fnum
- End Sub
- Public Sub DeleteCdrom()
- For i = 2 To TreeView1.Nodes.Count
- If TreeView1.Nodes.Item(i).Key = TreeView1.SelectedItem.Key Then
- Exit For
- End If
- Next
- RichTextBox1.Text = ""
- If Dir(TreeView1.Nodes(i).Text + ".cdo") <> "" Then
- Kill TreeView1.Nodes(i).Text + ".cdo"
- End If
- If Dir(TreeView1.Nodes(i).Text + ".mx") <> "" Then
- Kill TreeView1.Nodes(i).Text + ".mx"
- End If
- TreeView1.Nodes.Remove i
- TreeView2.Nodes.Clear
- WriteToDisk
- End Sub