?? databackup.ctl
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.UserControl DataBackup
ClientHeight = 3315
ClientLeft = 0
ClientTop = 0
ClientWidth = 6015
LockControls = -1 'True
ScaleHeight = 3315
ScaleWidth = 6015
ToolboxBitmap = "DataBackup.ctx":0000
Begin MSComDlg.CommonDialog dlgBrowser
Left = 105
Top = -345
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
ForeColor = &H00FF0000&
Height = 3360
Left = 0
TabIndex = 8
Top = -60
Width = 5985
Begin VB.PictureBox picStatus
BackColor = &H00FF0000&
Height = 165
Left = 255
ScaleHeight = 105
ScaleWidth = 5445
TabIndex = 15
Top = 1695
Visible = 0 'False
Width = 5505
Begin VB.Label lbStatus
Height = 165
Left = 0
TabIndex = 16
Top = 0
Width = 5505
End
End
Begin VB.CommandButton cmdRestore
Caption = "開始恢復"
Height = 900
Left = 4770
Picture = "DataBackup.ctx":0312
Style = 1 'Graphical
TabIndex = 14
Top = 2205
Width = 990
End
Begin VB.CommandButton cmdBackup
Caption = "開始備份"
Height = 915
Left = 4755
Picture = "DataBackup.ctx":0BDC
Style = 1 'Graphical
TabIndex = 13
Top = 630
Width = 990
End
Begin VB.CommandButton cmdSelect4
Caption = ".."
Height = 240
Left = 4380
TabIndex = 7
Top = 2835
Width = 315
End
Begin VB.CommandButton cmdSelect2
Caption = ".."
Height = 240
Left = 4380
TabIndex = 5
Top = 1290
Width = 315
End
Begin VB.TextBox txtBackupFileTo
Height = 285
Left = 255
TabIndex = 1
Top = 1260
Width = 4455
End
Begin VB.CommandButton cmdSelect3
Caption = ".."
Height = 240
Left = 4380
TabIndex = 6
Top = 2250
Width = 315
End
Begin VB.TextBox txtRestoreFileFrom
Height = 285
Left = 240
TabIndex = 2
Top = 2220
Width = 4470
End
Begin VB.CommandButton cmdSelect1
Caption = ".."
Height = 240
Left = 4380
TabIndex = 4
Top = 675
Width = 315
End
Begin VB.TextBox txtBackupFileFrom
Height = 285
Left = 255
TabIndex = 0
Top = 645
Width = 4455
End
Begin VB.TextBox txtRestoreFileTo
Height = 285
Left = 240
TabIndex = 3
Top = 2805
Width = 4470
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "請選擇需要《恢復》到的目錄:"
ForeColor = &H000040C0&
Height = 180
Index = 1
Left = 285
TabIndex = 12
Top = 2580
Width = 2520
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "請選擇需要《備份》到的目錄:"
ForeColor = &H000040C0&
Height = 180
Index = 1
Left = 270
TabIndex = 11
Top = 1020
Width = 2520
End
Begin VB.Line Line1
BorderColor = &H00FFFFFF&
Index = 1
X1 = 255
X2 = 5745
Y1 = 1770
Y2 = 1770
End
Begin VB.Line Line1
Index = 0
X1 = 270
X2 = 5730
Y1 = 1755
Y2 = 1755
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "請選擇需要《恢復》的文件:"
ForeColor = &H00008000&
Height = 180
Index = 0
Left = 285
TabIndex = 10
Top = 1980
Width = 2340
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "請選擇需要《備份》的文件:"
ForeColor = &H00800000&
Height = 180
Index = 0
Left = 255
TabIndex = 9
Top = 405
Width = 2340
End
End
End
Attribute VB_Name = "DataBackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private Sub cmdBackup_Click()
On Error GoTo BackupErr
'檢測備份路徑與其它是否為空
If Trim(txtBackupFileFrom.Text) = "" Then
MsgBox "對不起,請輸入要備份的文件后,才能備份! ", vbInformation
txtBackupFileFrom.SetFocus
Exit Sub
End If
If Dir(Trim(txtBackupFileFrom.Text), vbNormal) = "" Then
MsgBox "Sorry,輸入備份的文件不存在或不能訪問? ", vbInformation
txtBackupFileFrom.SetFocus
Exit Sub
End If
If Trim(txtBackupFileTo.Text) = "" Then
MsgBox "對不起,請輸入備份路徑,才能備份! ", vbInformation
txtBackupFileTo.SetFocus
Exit Sub
End If
If Dir(Trim(txtBackupFileTo.Text), vbDirectory) = "" Then
MsgBox "Sorry,輸入備份的路徑不存在或不能訪問? ", vbInformation
txtBackupFileTo.SetFocus
Exit Sub
End If
'給出備份的文件名
If Right(txtBackupFileTo.Text, 1) <> "\" Then
txtBackupFileTo.Text = txtBackupFileTo.Text & GetFileName(txtBackupFileFrom.Text)
Else
txtBackupFileTo.Text = Left(txtBackupFileTo.Text, Len(txtBackupFileTo.Text) - 1) & GetFileName(txtBackupFileFrom.Text)
End If
Screen.MousePointer = 11
StartIt "Backup"
Screen.MousePointer = 0
Exit Sub
BackupErr:
MsgBox "備份文件錯誤:" & Err.Description, vbCritical
Exit Sub
End Sub
Private Sub cmdRestore_Click()
On Error GoTo BackupErr
'檢測備份路徑與其它是否為空
If Trim(txtRestoreFileFrom.Text) = "" Then
MsgBox "對不起,請輸入要恢復的文件后,才能備份! ", vbInformation
txtRestoreFileFrom.SetFocus
Exit Sub
End If
If Dir(Trim(txtRestoreFileFrom.Text), vbNormal) = "" Then
MsgBox "Sorry,輸入恢復的文件不存在或不能訪問? ", vbInformation
txtRestoreFileFrom.SetFocus
Exit Sub
End If
If Trim(txtRestoreFileTo.Text) = "" Then
MsgBox "對不起,請輸入要恢復路徑,才能恢復! ", vbInformation
txtRestoreFileTo.SetFocus
Exit Sub
End If
If Dir(Trim(txtRestoreFileTo.Text), vbDirectory) = "" Then
MsgBox "Sorry,輸入恢復的路徑不存在或不能訪問? ", vbInformation
txtRestoreFileTo.SetFocus
Exit Sub
End If
Screen.MousePointer = 11
StartIt "Restore"
Screen.MousePointer = 0
Exit Sub
BackupErr:
MsgBox "恢復文件錯誤:" & Err.Description, vbCritical
Exit Sub
End Sub
Private Sub cmdSelect1_Click()
On Error Resume Next
dlgBrowser.DialogTitle = "請選擇需要備份的文件"
dlgBrowser.CancelError = True
dlgBrowser.Filter = "所有文件(*.*)|*.*|Access文件(*.MDB)|*.MDB|VB中國備份文件(*.YVB)|*.YVB"
dlgBrowser.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly + cdlOFNPathMustExist
dlgBrowser.ShowOpen
txtBackupFileFrom = dlgBrowser.FileName
txtBackupFileFrom.SetFocus
If Err.Number = 32755 Then '取消時
Exit Sub
End If
End Sub
Private Sub cmdSelect2_Click()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -