📄 frmbf.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Frmbf
BorderStyle = 3 'Fixed Dialog
Caption = "备份数据进程"
ClientHeight = 960
ClientLeft = 5460
ClientTop = 6300
ClientWidth = 5670
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 960
ScaleWidth = 5670
ShowInTaskbar = 0 'False
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 10
Left = 4440
Top = 0
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 240
TabIndex = 0
Top = 480
Width = 5175
_ExtentX = 9128
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin VB.Label Label1
Caption = "正在备份系统数据……"
Height = 255
Left = 240
TabIndex = 1
Top = 120
Width = 3735
End
End
Attribute VB_Name = "Frmbf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub CopyFileWindowsWay(SourceFile As String, DestinationFile As String)
Dim lngReturn As Long
Dim typFileOperation As SHFILEOPSTRUCT
With typFileOperation
.hwnd = 0
.wFunc = FO_COPY
.pFrom = SourceFile & vbNullChar & vbNullChar '源文件。
.pTo = DestinationFile & vbNullChar & vbNullChar '目标文件。
.fFlags = FOF_ALLOWUNDO
End With
'拷贝操作。
lngReturn = SHFileOperation(typFileOperation)
If lngReturn <> 0 Then '如果拷贝失败。
MsgBox "数据备份失败!", vbInformation Or vbOKOnly, "提示信息"
Shibai = True
Exit Sub
Else
If typFileOperation.fAnyOperationsAborted = True Then
MsgBox "Operation Failed", vbInformation Or vbOKOnly
End If
End If
End Sub
Private Sub Form_Load()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Me.ProgressBar1.Value = 10
Dim lj As String
lj = Frmbflj.Dir1.Path
If lj = "c:\" Or lj = "d:\" Or lj = "e:\" Or lj = "f:\" Or lj = "g:\" Or lj = "h:\" Or lj = "i:\" Then
Call CopyFileWindowsWay(App.Path & "\data.mdb", lj & Frmbflj.Text1.Text & ".ofb")
If Shibai = True Then
Shibai = False
Exit Sub
End If
Else
Call CopyFileWindowsWay(App.Path & "\data.mdb", lj & "\" & Frmbflj.Text1.Text & ".ofb")
If Shibai = True Then
Shibai = False
Exit Sub
End If
End If
Me.ProgressBar1.Value = 70
Me.ProgressBar1.Value = 80
Me.ProgressBar1.Value = 100
Unload Me
MsgBox "数据备份成功!", vbOKOnly Or vbInformation, "信息提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -