addcdrom1.frm
上传用户:dohkov
上传日期:2007-06-18
资源大小:35k
文件大小:5k
- VERSION 5.00
- Begin VB.Form AddCdrom
- BorderStyle = 1 'Fixed Single
- Caption = "选择光盘盘符"
- ClientHeight = 1650
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5040
- ControlBox = 0 'False
- Icon = "addcdrom1.frx":0000
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1650
- ScaleWidth = 5040
- StartUpPosition = 3 '窗口缺省
- Begin VB.ComboBox Combo2
- Height = 300
- Left = 120
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 360
- Width = 2775
- End
- Begin VB.CommandButton Command2
- Cancel = -1 'True
- Caption = "取消"
- Height = 375
- Left = 3720
- TabIndex = 2
- Top = 600
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "确定"
- Default = -1 'True
- Height = 375
- Left = 3720
- TabIndex = 1
- Top = 120
- Width = 1095
- End
- Begin VB.ComboBox Combo1
- Height = 300
- Left = 120
- Style = 2 'Dropdown List
- TabIndex = 0
- Top = 960
- Width = 2775
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Height = 180
- Left = 120
- TabIndex = 6
- Top = 1320
- Width = 90
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "请选择该光盘的存放位置"
- Height = 180
- Left = 120
- TabIndex = 5
- Top = 120
- Width = 1980
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "请选择一个光驱"
- Height = 180
- Left = 120
- TabIndex = 3
- Top = 720
- Width = 1260
- End
- End
- Attribute VB_Name = "AddCdrom"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- On Error GoTo handle
- Me.MousePointer = 11
- Me.Caption = "正在生成光盘镜像文件...这可能需要几分钟或更长时间"
- Dim sDriver As String
- sDriver = Right(Combo1.List(Combo1.ListIndex), 2) + ""
- MainForm.TreeView2.Nodes.Clear
- MainForm.TreeView2.Nodes.Add , , sDriver, sDriver, 1
- Dim acontrol As Control
- GetFoldersAndFiles sDriver
- MainForm.TreeView2.Nodes(1).Expanded = True
- fatherKey = "光盘库" + Combo2.List(Combo2.ListIndex)
- mykey = "子光盘" + fatherKey + "@@@@@***##" + CdromName
- Set nox = MainForm.TreeView1.Nodes.Add(fatherKey, tvwChild, mykey, CdromName, 1)
- MainForm.TreeView1.SelectedItem = nox
- fnum = FreeFile
- cdromfile = CdromName + ".cdo"
- Open cdromfile For Output As #fnum
- Print #fnum, "@@@@@***##光盘镜像文件@@@@@***##"
- For i = 1 To MainForm.TreeView2.Nodes.Count
- Print #fnum, MainForm.TreeView2.Nodes(i).Key
- Next
- Close fnum
- On Error GoTo 0
- MainForm.Label1.Caption = Combo1.List(Combo1.ListIndex) + " " + Chr(34) + CdromName + Chr(34) + " 中的文件夹与文件"
- Me.Caption = "请选择光盘盘符"
- Me.MousePointer = 0
- Mx = InputBox("请输入有关于光盘 " + Chr(34) + CdromName + Chr(34) + " 的描述")
- fnum = FreeFile
- Open CdromName + ".mx" For Output As #fnum
- Print #fnum, Trim(Mx)
- Close fnum
- Unload Me
- MainForm.RichTextBox1.Text = Mx
- Exit Sub
- handle:
- If Err.Number = 76 Then
- MsgBox "光盘没有放入 " + Combo1.List(Combo1.ListIndex) + " 中", vbCritical
- Else
- MsgBox "未知错误!", vbCritical
- End If
- Me.Caption = "选择光盘盘符"
- Me.MousePointer = 0
- Exit Sub
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- CencerForm Me
- Dim DriveNameNum As Single, DriveName As String
- '找出所有的光驱
- DriveNameNum = Asc("a") - 1
- For i = 1 To 26
- DriveNameNum = DriveNameNum + 1
- DriveName = Chr(DriveNameNum) + ":"
- ndrivetype = GetDriveType(DriveName)
- If ndrivetype = 5 Then
- Combo1.AddItem "光驱 " + Trim(UCase(Chr(DriveNameNum))) + ":"
- End If
- Next
- If Combo1.ListCount > 1 Then
- Combo1.ListIndex = 0
- Else
- MsgBox "你没有光驱,缷载本软件吧!", vbCritical
- End
- End If
- '读出所有类别
- For i = 2 To MainForm.TreeView1.Nodes.Count
- If Left(MainForm.TreeView1.Nodes.Item(i).Key, 3) = "光盘库" Then
- Combo2.AddItem MainForm.TreeView1.Nodes.Item(i).Text
- End If
- Next
- '匹配类别
- If MainForm.TreeView1.SelectedItem.Key = "光盘库" Then
- Else
- For i = 0 To Combo2.ListCount - 1
- If Combo2.List(i) = MainForm.TreeView1.SelectedItem.Text Or MainForm.TreeView1.SelectedItem.Parent.Text = Combo2.List(i) Then
- Combo2.ListIndex = i
- End If
- Next
- End If
- End Sub