📄 frmdatabackup.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmdatabackup
Caption = "数据备份"
ClientHeight = 4995
ClientLeft = 60
ClientTop = 450
ClientWidth = 7110
LinkTopic = "Form1"
ScaleHeight = 4995
ScaleWidth = 7110
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 390
Left = 4800
TabIndex = 16
Top = 240
Visible = 0 'False
Width = 1575
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 855
Left = 0
TabIndex = 15
Top = 0
Width = 7110
_ExtentX = 12541
_ExtentY = 1508
ButtonWidth = 1455
ButtonHeight = 1349
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 2
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "备份数据"
ImageIndex = 2
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
ImageIndex = 1
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 3840
Top = 120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 8
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":0452
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":08A4
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":0CF6
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":1148
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":159A
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":19EC
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmdatabackup.frx":1D06
Key = ""
EndProperty
EndProperty
End
End
Begin MSComCtl2.DTPicker dtp1
Height = 375
Left = 3360
TabIndex = 14
Top = 960
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 48889857
CurrentDate = 38846
End
Begin VB.DirListBox Dir1
Height = 2820
Left = 2640
TabIndex = 13
Top = 1440
Width = 2655
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 2640
TabIndex = 12
Top = 4440
Width = 2655
End
Begin VB.FileListBox File1
Height = 3330
Left = 120
TabIndex = 11
Top = 1440
Width = 2415
End
Begin VB.TextBox txtfilename
Height = 375
Left = 120
TabIndex = 10
Text = "Text1"
Top = 960
Width = 2415
End
Begin VB.Image Image1
Height = 435
Left = 2760
Picture = "frmdatabackup.frx":2AB8
Stretch = -1 'True
Top = 960
Width = 345
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "数据资料备份"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 9
Top = 120
Width = 2775
End
Begin VB.Shape Shape1
Height = 3135
Left = 5400
Top = 1680
Width = 1575
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "驱动器信息"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5400
TabIndex = 8
Top = 1200
Width = 1575
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "当前驱动器:"
Height = 255
Left = 5520
TabIndex = 7
Top = 1800
Width = 1335
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "总计空间:"
Height = 255
Left = 5520
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "使用空间"
Height = 255
Left = 5520
TabIndex = 5
Top = 3360
Width = 1335
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "剩余空间:"
Height = 255
Left = 5520
TabIndex = 4
Top = 4080
Width = 1335
End
Begin VB.Label lblDrive
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 375
Left = 5520
TabIndex = 3
Top = 2040
Width = 1335
End
Begin VB.Label lbltotalsize
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 375
Left = 5520
TabIndex = 2
Top = 2880
Width = 1335
End
Begin VB.Label lblusesize
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 375
Left = 5520
TabIndex = 1
Top = 3600
Width = 1335
End
Begin VB.Label lblfreesize
BackStyle = 0 'Transparent
ForeColor = &H00000000&
Height = 375
Left = 5520
TabIndex = 0
Top = 4320
Width = 1335
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 Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.*"
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)
lblusesize.Caption = FormatNumber(Drv.TotalSize / 1024 - Drv.FreeSpace / 1024, 0)
End Sub
Private Sub dtp1_Change()
Text1.Text = Format(dtp1.Value, "yyyymmdd")
txtfilename = Text1.Text
End Sub
Private Sub File1_Click()
txtfilename.Text = File1.filename
End Sub
Private Sub Form_Load()
frmdatabackup.BackColor = RGB(77, 116, 244)
Text1.Text = Format(Date, "yyyymmdd")
dtp1.Value = Date
Drive1.Drive = "d:"
Dir1.Path = "d:\system\database\"
txtfilename = Text1.Text
lblDrive.Caption = 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)
lblusesize.Caption = FormatNumber(Drv.TotalSize / 1024 - Drv.FreeSpace / 1024, 0)
End Sub
Private Sub Image1_Click()
Dim Basename As String
Dim FileExist As Boolean
Dim Response
Set fil = fso.GetFile("c:\program files\microsoft sql server\mssql\data\")
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 Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Image1_Click
Case 2
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -