Restore.frm
上传用户:dohkov
上传日期:2007-06-18
资源大小:35k
文件大小:11k
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form Restore
- Caption = "恢复--选定文件到右边的列表框中供恢复"
- ClientHeight = 4275
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 7365
- ControlBox = 0 'False
- LinkTopic = "Form1"
- ScaleHeight = 4275
- ScaleWidth = 7365
- StartUpPosition = 3 '窗口缺省
- Begin VB.CommandButton RemoveAll
- Height = 375
- Left = 4320
- Picture = "Restore.frx":0000
- Style = 1 'Graphical
- TabIndex = 14
- ToolTipText = "移走全部恢复文件"
- Top = 2640
- Width = 615
- End
- Begin VB.CommandButton Remove
- Height = 375
- Left = 4320
- Picture = "Restore.frx":0152
- Style = 1 'Graphical
- TabIndex = 13
- ToolTipText = "移走选定的恢复文件"
- Top = 1440
- Width = 615
- End
- Begin MSComctlLib.ProgressBar ProgressBar1
- Height = 375
- Left = 120
- TabIndex = 12
- Top = 3720
- Visible = 0 'False
- Width = 4455
- _ExtentX = 7858
- _ExtentY = 661
- _Version = 393216
- Appearance = 1
- End
- Begin VB.CommandButton LeftAll
- Height = 375
- Left = 4320
- Picture = "Restore.frx":0594
- Style = 1 'Graphical
- TabIndex = 9
- ToolTipText = "全部文件供恢复"
- Top = 2040
- Width = 615
- End
- Begin VB.CommandButton LeftMove
- Height = 375
- Left = 4320
- Picture = "Restore.frx":06E6
- Style = 1 'Graphical
- TabIndex = 8
- ToolTipText = "选定文件供还原"
- Top = 840
- Width = 615
- End
- Begin VB.DriveListBox Drive1
- Height = 300
- Left = 120
- TabIndex = 6
- Top = 3000
- Width = 2055
- End
- Begin VB.CommandButton Command2
- Cancel = -1 'True
- Caption = "取消"
- Height = 375
- Left = 6120
- TabIndex = 5
- Top = 3720
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "开始恢复"
- Default = -1 'True
- Height = 375
- Left = 4680
- TabIndex = 4
- Top = 3720
- Width = 1215
- End
- Begin VB.ListBox List1
- Height = 2760
- Left = 5040
- MultiSelect = 2 'Extended
- TabIndex = 3
- Top = 480
- Width = 2175
- End
- Begin VB.FileListBox File1
- Height = 2430
- Left = 2280
- MultiSelect = 2 'Extended
- TabIndex = 2
- Top = 480
- Width = 1935
- End
- Begin VB.ComboBox Combo1
- Height = 300
- Left = 2280
- Style = 2 'Dropdown List
- TabIndex = 1
- Top = 3000
- Width = 1935
- End
- Begin VB.DirListBox Dir1
- Height = 2400
- Left = 120
- TabIndex = 0
- Top = 480
- Width = 2055
- End
- Begin VB.Label Label3
- Caption = "要恢复的文件"
- Height = 255
- Left = 5040
- TabIndex = 11
- Top = 240
- Width = 1215
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "当前文件"
- Height = 180
- Left = 2280
- TabIndex = 10
- Top = 240
- Width = 720
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- Caption = "当前目录"
- Height = 180
- Left = 120
- TabIndex = 7
- Top = 240
- Width = 840
- End
- Begin VB.Line Line2
- BorderColor = &H00FFFFFF&
- X1 = 160
- X2 = 7200
- Y1 = 3495
- Y2 = 3495
- End
- Begin VB.Line Line1
- BorderColor = &H00000000&
- X1 = 160
- X2 = 7200
- Y1 = 3480
- Y2 = 3480
- End
- End
- Attribute VB_Name = "Restore"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Combo1_Click()
- Select Case Combo1.ListIndex
- Case 0
- File1.Pattern = "*.cdo;*.fnd;*.cds"
- Case 1
- File1.Pattern = "*.cdo"
- Case 2
- File1.Pattern = "*.fnd"
- Case 3
- File1.Pattern = "cdrom.cds"
- Case 4
- File1.Pattern = "*.*"
- End Select
- End Sub
- Private Sub Command1_Click()
- On Error GoTo Errorhandle
- If List1.ListCount < 1 Then
- MsgBox "没有文件供恢复!" + Chr(13) + Chr(13) + "如果你不想恢复,请单击取消退出!", vbExclamation
- Exit Sub
- End If
- If vbYes = MsgBox("确实要恢复文件,这可能会造成当前光盘镜像文件的丢失!" + Chr(13) + Chr(13) + "要继续吗?", vbQuestion + vbYesNo) Then
- Me.MousePointer = 11
- Me.ProgressBar1.Max = List1.ListCount - 1 + 1
- Me.ProgressBar1.Visible = True
- For i = 0 To UBound(RestoreFile)
- If LCase(List1.List(i)) = "cdrom.cds" Then
- Dim AppCds() As String
- Dim ResCds() As String
- fnum = FreeFile
- j = 0
- Open RestoreFile(i) For Input As #fnum
- Do While Not EOF(fnum)
- Line Input #fnum, mykey
- ReDim Preserve ResCds(j) As String
- ResCds(j) = mykey
- j = j + 1
- Loop
- Close fnum
- j = 0
- Open App.Path + "cdrom.cds" For Input As #fnum
- Do While Not EOF(fnum)
- Line Input #fnum, mykey
- ReDim Preserve AppCds(j) As String
- AppCds(j) = mykey
- j = j + 1
- Loop
- Close fnum
- For j = 0 To UBound(ResCds)
- For k = 0 To UBound(AppCds)
- If AppCds(k) = ResCds(j) Then
- Exit For
- End If
- Next
- If k > UBound(AppCds) Then
- fnum = FreeFile
- Open App.Path + "cdrom.cds" For Append As #fnum
- Print #fnum, ResCds(j)
- Close fnum
- End If
- Next
- Else
- FileCopy RestoreFile(i), List1.List(i)
- End If
- Me.ProgressBar1.Value = i
- Next
- Me.MousePointer = 0
- Me.ProgressBar1.Visible = False
- MsgBox "恢复完成!" + Chr(13) + Chr(13) + "必须重新启动光盘管家以使恢复生效!", vbInformation
- End
- End If
- Exit Sub
- Errorhandle:
- If Err.Number = 75 Then
- Me.ProgressBar1.Visible = False
- Me.MousePointer = 0
- MsgBox "不能存储文件,请检查你有否在此磁盘上有存储文件的权力!", vbCritical
- End If
- If Err.Number = 70 Then
- Me.ProgressBar1.Visible = False
- Me.MousePointer = 0
- MsgBox "磁盘被写保护,或者是无权写入!", vbCritical
- End If
- If Err.Number = 61 Then
- MsgBox "磁盘已满,请更换新盘!", vbInformation
- Me.ProgressBar1.Visible = False
- Me.MousePointer = 0
- End If
- End Sub
- Private Sub Command2_Click()
- Unload Me
- End Sub
- Private Sub Dir1_Change()
- File1.Path = Dir1.Path
- End Sub
- Private Sub Drive1_Change()
- On Error GoTo ErrorControl
- Dir1.Path = Drive1.Drive
- Exit Sub
- ErrorControl:
- Select Case Err.Number
- Case 52
- MsgBox "指定的磁盘驱动器不可用!" + Chr(13) + Chr(13) + "可能不存在此驱动器或驱动器内无磁盘!", vbCritical
- Case 57
- MsgBox "磁盘I/0错误,操作被终止!", vbCritical
- Case 61
- MsgBox "磁盘满,空间不够!", vbCritical
- Case 68
- MsgBox "磁盘没有放入驱动器中,请检查一下吧!", vbCritical
- Case 70
- MsgBox "磁盘被写保护 或 文件被保护!", vbCritical
- Case 71
- MsgBox "磁盘没准备好!", vbCritical
- End Select
- End Sub
- Private Sub Form_Load()
- CencerForm Me
- Combo1.AddItem "所有可恢复文件"
- Combo1.AddItem "光盘镜像文件[*.CDO]"
- Combo1.AddItem "搜索结果文件[*.FND]"
- Combo1.AddItem "光盘镜像注册表"
- Combo1.AddItem "所有文件[*.*]"
- Combo1.ListIndex = 0
- ChDir ("..")
- Dir1.Path = CurDir
- ChDir App.Path
- End Sub
- Private Sub LeftAll_Click()
- Dim You As Boolean
- You = False
- For i = File1.ListCount - 1 To 0 Step -1
- For j = 0 To List1.ListCount - 1
- sdirectory = Dir1.Path
- If Right(Dir1.Path, 1) <> "" Then
- sdirectory = Dir1.Path + ""
- End If
- If sdirectory + File1.List(i) = RestoreFile(j) Then
- You = True
- Exit For
- End If
- Next
- If Not You Then
- List1.AddItem File1.List(i)
- ReDim Preserve RestoreFile(List1.ListCount - 1) As String
- sdirectory = Dir1.Path
- If Right(Dir1.Path, 1) <> "" Then
- sdirectory = Dir1.Path + ""
- End If
- RestoreFile(List1.ListCount - 1) = sdirectory + File1.List(i)
- You = False
- End If
- Next
- End Sub
- Private Sub LeftMove_Click()
- Dim You As Boolean
- You = False
- For i = File1.ListCount - 1 To 0 Step -1
- If File1.Selected(i) Then
- For j = 0 To List1.ListCount - 1
- sdirectory = Dir1.Path
- If Right(Dir1.Path, 1) <> "" Then
- sdirectory = Dir1.Path + ""
- End If
- If sdirectory + File1.List(i) = RestoreFile(j) Then
- You = True
- Exit For
- End If
- Next
- If Not You Then
- List1.AddItem File1.List(i)
- ReDim Preserve RestoreFile(List1.ListCount - 1) As String
- sdirectory = Dir1.Path
- If Right(Dir1.Path, 1) <> "" Then
- sdirectory = Dir1.Path + ""
- End If
- RestoreFile(List1.ListCount - 1) = sdirectory + File1.List(i)
- You = False
- End If
- End If
- Next
- End Sub
- Private Sub Remove_Click()
- For i = List1.ListCount - 1 To 0 Step -1
- If List1.Selected(i) Then
- For j = i To List1.ListCount - 2
- RestoreFile(j) = RestoreFile(j + 1)
- Next
- List1.RemoveItem i
- If List1.ListCount = 0 Then
- ReDim RestoreFile(0) As String
- Else
- ReDim Preserve RestoreFile(List1.ListCount - 1)
- End If
- End If
- Next
- End Sub
- Private Sub RemoveAll_Click()
- List1.Clear
- ReDim RestoreFile(0) As String
- End Sub