📄 frmbackup.frm
字号:
VERSION 5.00
Begin VB.Form frmbackup
BorderStyle = 3 'Fixed Dialog
Caption = "数据库备份"
ClientHeight = 2310
ClientLeft = 45
ClientTop = 330
ClientWidth = 4380
Icon = "frmbackup.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Picture = "frmbackup.frx":030A
ScaleHeight = 2310
ScaleWidth = 4380
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "退出&(Q)"
Height = 300
Left = 240
TabIndex = 5
Top = 1870
Width = 1215
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 1680
TabIndex = 2
Top = 120
Width = 2535
End
Begin VB.DirListBox Dir1
Height = 1560
Left = 1680
TabIndex = 1
Top = 600
Width = 2535
End
Begin VB.CommandButton Command1
Caption = "备份&(B)"
Height = 300
Left = 240
TabIndex = 0
Top = 1440
Width = 1215
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择备份文件夹"
Height = 180
Left = 240
TabIndex = 4
Top = 600
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择备份驱动器"
Height = 180
Left = 240
TabIndex = 3
Top = 165
Width = 1260
End
End
Attribute VB_Name = "frmbackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public ml As String
Private Sub Command1_Click()
Dim result As Long, fileop As SHFILEOPSTRUCT
With fileop
.hwnd = Me.hwnd
.wFunc = FO_COPY
.pFrom = "C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\VB.HLP" & vbNullChar & "C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\README.HLP" & vbNullChar & vbNullChar
'.pFrom = "C:\*.*" & vbNullChar & vbNullChar
.pFrom = Frmstart.servername & Frmstart.serverpath & "\*.*" & vbNullChar & vbNullChar
.pTo = ml & vbNullChar & vbNullChar
.fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY
End With
result = SHFileOperation(fileop)
If result <> 0 Then
' Operation failed
MsgBox "放弃远程数据库备份!" 'Err.LastDllError
Else
If fileop.fAnyOperationsAborted <> 0 Then
MsgBox "无法读取数据库,远程备份失败!"
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
ml = Dir1.Path
If Right(ml, 1) <> "\" Then
ml = Dir1.Path + "\backuphims"
Else
ml = Dir1.Path + "backuphims"
End If
End Sub
Private Sub Drive1_Change()
On Error GoTo err2
Dir1.Path = Drive1.Drive
Exit Sub
err2:
MsgBox "无效的驱动器或驱动器中没有磁盘!"
Drive1.Drive = "C:\"
End Sub
Private Sub Form_Load()
frmbackup.Top = (frmmain.Height - frmbackup.Height) / 2 - 500
frmbackup.Left = (frmmain.Width - frmbackup.Width) / 2
ml = "C:\backuphims"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
End Sub
Private Sub Form_Activate()
frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmbackup.Caption
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -