📄 frmdatabackup.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmDataBackup
BorderStyle = 1 'Fixed Single
Caption = "数据库备份"
ClientHeight = 4635
ClientLeft = 45
ClientTop = 330
ClientWidth = 7305
FillColor = &H00404040&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4635
ScaleWidth = 7305
StartUpPosition = 2 '屏幕中心
Begin ComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 855
Left = 0
TabIndex = 0
Top = 0
Width = 7305
_ExtentX = 12885
_ExtentY = 1508
ButtonWidth = 1773
ButtonHeight = 1349
Appearance = 1
ImageList = "ImageList1"
_Version = 327682
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 4
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "数据库备份"
Key = "Backup"
Object.ToolTipText = "数据库备份"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.Tag = ""
Style = 3
MixedState = -1 'True
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Object.Tag = ""
Style = 3
MixedState = -1 'True
EndProperty
BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}
Caption = "退 出"
Key = "Close"
Object.ToolTipText = "退 出"
Object.Tag = ""
ImageIndex = 2
EndProperty
EndProperty
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "驱动器信息"
ForeColor = &H00FF0000&
Height = 3240
Left = 5400
TabIndex = 10
Top = 1050
Width = 1665
Begin VB.Label lblUsedSize
BackColor = &H00C0C0C0&
Caption = "Label6"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 150
TabIndex = 18
Top = 2100
Width = 1365
End
Begin VB.Label Label9
BackColor = &H00C0C0C0&
Caption = "剩余空间"
ForeColor = &H00FF0000&
Height = 240
Left = 150
TabIndex = 17
Top = 2550
Width = 1140
End
Begin VB.Label lblFreeSize
BackColor = &H00C0C0C0&
Caption = "Label6"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 150
TabIndex = 16
Top = 2925
Width = 1365
End
Begin VB.Label Label6
BackColor = &H00C0C0C0&
Caption = "使用空间"
ForeColor = &H00FF0000&
Height = 240
Left = 150
TabIndex = 15
Top = 1725
Width = 1140
End
Begin VB.Label lblTotalSize
BackColor = &H00C0C0C0&
Caption = "Label5"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 150
TabIndex = 14
Top = 1350
Width = 1365
End
Begin VB.Label Label4
BackColor = &H00C0C0C0&
Caption = "总计空间"
ForeColor = &H00FF0000&
Height = 240
Left = 150
TabIndex = 13
Top = 975
Width = 1140
End
Begin VB.Label lblDrive
BackColor = &H00C0C0C0&
Caption = "1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 150
TabIndex = 12
Top = 600
Width = 1365
End
Begin VB.Label Label3
BackColor = &H00C0C0C0&
Caption = "当前驱动器"
ForeColor = &H00FF0000&
Height = 240
Left = 150
TabIndex = 11
Top = 300
Width = 990
End
End
Begin VB.TextBox txtFileName
BackColor = &H00C0FFFF&
ForeColor = &H00FF0000&
Height = 300
Left = 240
TabIndex = 9
Top = 1290
Width = 2235
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 3960
TabIndex = 7
Top = 1005
Width = 1335
_ExtentX = 2355
_ExtentY = 450
_Version = 393216
Format = 24576001
CurrentDate = 36740
End
Begin VB.DirListBox Dir1
BackColor = &H00C0FFFF&
ForeColor = &H00FF0000&
Height = 2610
Left = 2580
TabIndex = 6
Top = 1290
Width = 2715
End
Begin VB.DriveListBox Drive1
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 330
Left = 2580
TabIndex = 5
Top = 3930
Width = 2715
End
Begin VB.FileListBox File1
BackColor = &H00C0FFFF&
ForeColor = &H00FF0000&
Height = 2610
Left = 240
TabIndex = 4
Top = 1650
Width = 2235
End
Begin VB.CommandButton cmdClose
Caption = "退出"
Height = 375
Left = 3675
TabIndex = 2
Top = 4275
Visible = 0 'False
Width = 855
End
Begin VB.CommandButton cmdBackup
Caption = "备份"
Height = 375
Left = 1950
TabIndex = 1
Top = 4275
Visible = 0 'False
Width = 855
End
Begin VB.Label Label2
Caption = "备份日期"
ForeColor = &H00FF0000&
Height = 255
Left = 3120
TabIndex = 8
Top = 1065
Width = 735
End
Begin VB.Label Label1
Caption = "选择备份路径:"
ForeColor = &H00FF0000&
Height = 255
Left = 240
TabIndex = 3
Top = 1005
Width = 1455
End
Begin ComctlLib.ImageList ImageList1
Left = 450
Top = 4050
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 327682
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 2
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "frmDataBackup.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = "frmDataBackup.frx":031A
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmDataBackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Fso As New FileSystemObject
Dim Drv As Drive
Dim Fil As File
Private Sub cmdBackup_Click()
Dim BaseName As String
Dim FileExist As Boolean
Dim Response
Set Fil = Fso.GetFile("c:\system\database\system.mdb")
If Right$(Dir1.Path, 1) = "\" Then
BaseName = Dir1.Path + Trim(txtFileName.Text)
Else
BaseName = Dir1.Path + "\" + Trim(txtFileName.Text)
End If
FileExist = Fso.FileExists(BaseName)
If FileExist = True Then
Response = MsgBox("指定文件已经存在,是否覆盖?", vbOKCancel, "确认覆盖")
If Response = vbOK Then
Fil.Copy BaseName, True
Exit Sub
Else
Exit Sub
End If
Else
Fil.Copy BaseName, True
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.mdb"
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
lblDrive = UCase(Drive1.Drive)
Set Drv = Fso.GetDrive(Fso.GetDriveName(Drive1.Drive))
lblTotalSize.Caption = FormatNumber(Drv.TotalSize / 1024, 0)
lblFreeSize.Caption = FormatNumber(Drv.FreeSpace / 1024, 0)
lblUsedSize.Caption = FormatNumber(Drv.TotalSize / 1024 - Drv.FreeSpace / 1024, 0)
End Sub
Private Sub DTPicker1_Change()
txtFileName = Mid(DTPicker1.Value, 1, 4) & Mid(DTPicker1.Value, 6, 2) & Mid(DTPicker1.Value, 9, 2) & ".mdb"
End Sub
Private Sub File1_Click()
txtFileName = File1.FileName
End Sub
Private Sub Form_Load()
DTPicker1.Value = Date
Drive1.Drive = "C:"
Dir1.Path = "C:\SYSTEM\DATABASE"
txtFileName = Mid(DTPicker1.Value, 1, 4) & Mid(DTPicker1.Value, 6, 2) & Mid(DTPicker1.Value, 9, 2) & ".mdb"
'Set Fso = CreateObject("Scripting.FileSystemObject")
lblDrive = UCase(Drive1.Drive)
Set Drv = Fso.GetDrive(Fso.GetDriveName(Drive1.Drive))
lblTotalSize.Caption = FormatNumber(Drv.TotalSize / 1024, 0)
lblFreeSize.Caption = FormatNumber(Drv.FreeSpace / 1024, 0)
lblUsedSize.Caption = FormatNumber(Drv.TotalSize / 1024 - Drv.FreeSpace / 1024, 0)
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
Select Case Button.Key
Case "Backup"
cmdBackup_Click
Case "Close"
cmdClose_Click
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -