⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 oracle和sql自动备份系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
nidProgramData.hIcon = Image1(0).Picture  '“托盘”中放入窗体图标,你可以把窗体的图标换成你所喜欢的图标

nidProgramData.szTip = "数据库自动备份系统" & vbNullChar

End With


'调用该函数

Shell_NotifyIcon NIM_ADD, nidProgramData

Call frmshow

Set Myfile = Controls.Add("VB.FileListBox", "Myfile", Me)


Backflag = False '备份标记为假

Me.Hide

Tempstr = "系统正常启动。"
      
Call writerizhi(Tempstr, Len(Tempstr))


On Error GoTo errhandler

Time_day = GetSetting("databackup", "sysinformation", "Opt_day")

Time_week = GetSetting("databackup", "sysinformation", "Opt_week")

Time_month = GetSetting("databackup", "sysinformation", "Opt_month")

Exit Sub

errhandler:

Call Defualt_Value

End Sub

Private Sub Form_Resize()

    If WindowState = vbMinimized Then
    
        Me.Hide
        
    End If
End Sub

'根据不同的鼠标消息做不同的操作

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)

On Error GoTo Form_MouseMove_err:

Dim Result As Long

Dim Msg As Long

'X的值依赖与显示模式的设置

If Me.ScaleMode = vbPixels Then

Msg = x

Else

Msg = x / Screen.TwipsPerPixelX

End If

Select Case Msg

Case WM_LBUTTONUP

Me.Show

Me.WindowState = vbNormal

CenterForm Me

Call frmshow


'在这里加入鼠标左键释放时你想做的操作

Case WM_LBUTTONDBLCLK

'在这里加入双击鼠标左键时你想做的操作

Case WM_RBUTTONUP

'通常这里弹出你的功能菜单

PopupMenu mnu_Tray

Case WM_MOUSEISMOVING

'在这里加入鼠标正在移动时你想做的操作

End Select

Exit Sub


Form_MouseMove_err:

'在这里加入你的处理异常错误的代码
End Sub

Private Sub Form_Unload(Cancel As Integer)

Cancel = -1

Call mnu_popup_exit_Click

End Sub

Private Sub mnu_about_Click()
Frmhelp.Show
End Sub

Private Sub mnu_popup_exit_Click()

Dim inttmp As Integer
    
   
    
    inttmp = MsgBox("确实要退出数据自动备份系统吗?", vbOKCancel + vbDefaultButton1 + vbQuestion, Me.Caption)


If inttmp = 1 Then
 
    Shell_NotifyIcon NIM_DELETE, nidProgramData
 
    Tempstr = "系统安全退出。"
          
    Call writerizhi(Tempstr, Len(Tempstr))

End

End If

End Sub

Private Sub mnu_popup_set_Click()

Frmset.Show

End Sub


Public Sub frmshow()

Lbl_leixing.Caption = IIf(GetSetting("databackup", "sysinformation", "OptOracle") = "True", "ORACLE 数据库", "SQL 数据库")

Lbl_fangshi.Caption = IIf(GetSetting("databackup", "sysinformation", "Opthand") = "True", "手工备份", "自动备份")

Lbl_moshi.Caption = "完全备份"

lbl_diaodu.Caption = IIf(GetSetting("databackup", "sysinformation", "Opt_day") = "True", "每天  " + GetSetting("databackup", "sysinformation", "DTP_day"), "每月  第" + GetSetting("databackup", "sysinformation", "Txt_month") + "天 " + GetSetting("databackup", "sysinformation", "DTP_month"))

lbl_lujing.Caption = GetSetting("databackup", "sysinformation", "txt_backup_path")

lbl_jilu.Caption = IIf(GetSetting("databackup", "sysinformation", "Opt_day") = "True", GetSetting("databackup", "sysinformation", "Txt_note_day"), GetSetting("databackup", "sysinformation", "Txt_note_month"))

End Sub

Private Sub mnu_rizhi_Click()
Frmrizhi.Show
End Sub

Private Sub mnu_systemset_Click()
Frmset.Show
End Sub

Private Sub mun_exit_Click()
Call mnu_popup_exit_Click
End Sub

Private Sub mun_hide_Click()
 Me.Hide
End Sub

Private Sub Timer1_Timer()


StatusBar1.Panels(2).Text = Format(Date, "yyyy年m月d日")

StatusBar1.Panels(3).Text = "当前时间:" + CStr(Time)

'如果正在备份将不继续备份

If Backflag = True Then Exit Sub
'判定时间是否调度
Call timejudge

If diaodutime = False Then Exit Sub

'开始备份

If GetSetting("databackup", "sysinformation", "OptOracle") = "True" Then

Call Oraclebackup

Call DelRecord

Else

Call Sqlbackup

Call DelRecord

End If

End Sub

Private Sub timejudge()

Dim Strtime As String

diaodutime = False

If Time_day = True Then

Strtime = Format(GetSetting("databackup", "sysinformation", "DTP_day"), "hh-mm-ss")

If Strtime = Format(Time, "hh-mm-ss") Then diaodutime = True

End If

If Time_month = True And CStr(CInt(Mid(Format(Date, "yyyy-mm-dd"), 9, 2))) = CStr(CInt(GetSetting("databackup", "sysinformation", "Txt_month"))) Then

Strtime = Format(GetSetting("databackup", "sysinformation", "DTP_month"), "hh-mm-ss")

If Strtime = Format(Time, "hh-mm-ss") Then diaodutime = True

End If

If Time_week = True And CStr(CInt(Weekday(Date))) = CStr(CInt(GetSetting("databackup", "sysinformation", "Txt_week"))) Then

Strtime = Format(GetSetting("databackup", "sysinformation", "DTP_week"), "hh-mm-ss")

If Strtime = Format(Time, "hh-mm-ss") Then diaodutime = True

End If


End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

 Select Case Button.Index
        Case 1
            mun_hide_Click
        Case 2
            mnu_systemset_Click
            
        Case 3
            mnu_rizhi_Click
        
        Case 4
            mnu_about_Click
        Case 5
            mun_exit_Click
    End Select
End Sub
Private Sub DelRecord()
        
    Dim i, n As Integer
        
    Dim stemp, tmp As String
    
    
    
    Myfile.Path = GetSetting("databackup", "sysinformation", "txt_backup_path")
    
    Myfile.Refresh
    
    n = 1
    
    If Myfile.ListCount = 0 Then Exit Sub
    
    For i = 1 To Myfile.ListCount
    
     Myfile.ListIndex = i - 1
     
    If GetSetting("databackup", "sysinformation", "OptOracle") = "True" Then
   
       tmp = Mid(Myfile.FileName, 1, 10)
     
        If tmp = "OracleBack" Then
    
        M_file(n) = Myfile.FileName
    
        n = n + 1
    
        End If
    
    Else
    
       tmp = Mid(Myfile.FileName, 1, 7)
         
        If tmp = "SqlBack" Then
    
        M_file(n) = Myfile.FileName
    
        n = n + 1
    
        End If
       
       
    
    End If
     
    Next i
    
    
    If n = 1 Then Exit Sub
    
    
     If GetSetting("databackup", "sysinformation", "OptOracle") = "True" Then
     
        stemp = Min_list(M_file(), n - 2, 11)
     
     Else
     
        stemp = Min_list(M_file(), n - 2, 8)
    
     
     End If
 
    
    If GetSetting("databackup", "sysinformation", "Opt_day") = "True" Then

         If n - 1 > CInt(GetSetting("databackup", "sysinformation", "Txt_note_day")) Then
         
         For i = 1 To (n - 1) - CInt(GetSetting("databackup", "sysinformation", "Txt_note_day"))

            Kill Myfile.Path + "\" + M_file(i)
            
            Tempstr = "清理" + CStr(M_file(i) + "。")
      
            Call writerizhi(Tempstr, (3 + Round(Len(M_file(i)) / 2, 0)))
            
         Next i

         End If

    End If
   
   
     If GetSetting("databackup", "sysinformation", "Opt_month") = "True" Then

         If n - 1 > CInt(GetSetting("databackup", "sysinformation", "Txt_note_month")) Then
         
         For i = 1 To (n - 1) - CInt(GetSetting("databackup", "sysinformation", "Txt_note_month"))

            Kill Myfile.Path + "\" + M_file(i)
            
            Tempstr = "清理" + CStr(M_file(i) + "。")
      
             Call writerizhi(Tempstr, (3 + Round(Len(M_file(i)) / 2, 0)))
            
         Next i

         End If

    End If
    
End Sub

Private Sub Change_Icon()

If inco_sin = 0 Then

inco_sin = 1

Else

inco_sin = 0

End If

Shell_NotifyIcon NIM_DELETE, nidProgramData

nidProgramData.hIcon = Image1(inco_sin).Picture

Shell_NotifyIcon NIM_ADD, nidProgramData

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -