📄 frmmainfilecheck.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
Begin VB.Form frmMainFileCheck
BorderStyle = 1 'Fixed Single
Caption = "文件改变检查版本 (1.02)"
ClientHeight = 6225
ClientLeft = 45
ClientTop = 435
ClientWidth = 6765
Icon = "frmMainFileCheck.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6225
ScaleWidth = 6765
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 375
Left = 5520
TabIndex = 3
Top = 5760
Width = 1095
End
Begin VB.Timer tmrFileCheck
Interval = 2000
Left = 2760
Top = 2880
End
Begin MSComDlg.CommonDialog cd
Left = 3840
Top = 2880
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "Secure a file..."
Filter = "*.*"
InitDir = ".\"
End
Begin MSComctlLib.ImageList ilListview
Left = 3240
Top = 2880
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMainFileCheck.frx":0442
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMainFileCheck.frx":6064
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMainFileCheck.frx":D566
Key = ""
EndProperty
EndProperty
End
Begin VB.CommandButton Command3
Caption = "移除文件(&R)"
Height = 375
Left = 1740
TabIndex = 2
Top = 5760
Width = 1395
End
Begin VB.CommandButton Command1
Caption = "添加文件(&A)"
Default = -1 'True
Height = 375
Left = 120
TabIndex = 1
Top = 5760
Width = 1470
End
Begin MSComctlLib.ListView lvFiles
Height = 5535
Left = 120
TabIndex = 0
Top = 120
Width = 6495
_ExtentX = 11456
_ExtentY = 9763
View = 3
LabelEdit = 1
MultiSelect = -1 'True
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
Icons = "ilListview"
SmallIcons = "ilListview"
ColHdrIcons = "ilListview"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 2
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "原始路径"
Object.Width = 7056
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "备份路径"
Object.Width = 14112
EndProperty
End
End
Attribute VB_Name = "frmMainFileCheck"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居汉化收藏整理
'发布日期:2007/09/20
'描 述:界面清爽VB版高级专业防火墙 Ver 2.0.3
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit
Private lngMin As Long
Private Sub cmdClose_Click()
Me.Hide
End Sub
Private Sub Command1_Click()
On Error Resume Next
cd.ShowOpen
If LenB(cd.Filename) Then
lvAddItem cd.Filename
cd.Filename = vbNullString
End If
On Error GoTo 0
End Sub
Private Sub Command3_Click()
On Error Resume Next
RemoveFile lvFiles.SelectedItem.Text, lvFiles.SelectedItem.SubItems(1)
lvFiles.ListItems.Remove (lvFiles.SelectedItem.Index)
On Error GoTo 0
End Sub
Private Sub Form_Load()
Dim b() As String
Dim a As String
On Error Resume Next
Open "Backup.lst" For Input As #1
Do While EOF(1) = False
Line Input #1, a
b = Split(a, "|/\|")
lvLoadItem b(0), b(1)
ScanFile b(0)
DoEvents
Loop
Close #1
App.TaskVisible = True
On Error GoTo 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = True
Me.Hide
End Sub
Public Function GetNameOnly(strFile As String) As String
GetNameOnly = Mid$(strFile, InStrRev(strFile, "\"), Len(strFile) - InStrRev(strFile, "\") + 1)
GetNameOnly = GetNameOnly
End Function
Public Sub lvAddItem(Path As String, _
Optional ByVal lngIcon As Long = 2, _
Optional ByVal blnNew As Boolean = True)
Dim Item As ListItem
Dim i As Long
On Error Resume Next
If blnNew Then
Set Item = lvFiles.ListItems.Add()
With Item
.Text = Path
.SubItems(1) = App.Path & "\Backup" & GetNameOnly(Path)
.Icon = lngIcon
.SmallIcon = lngIcon
SecureFile Path, .SubItems(1)
End With 'item
Else
For i = 1 To lvFiles.ListItems.Count
If lvFiles.ListItems.Item(i).Text = Path Then
Set Item = lvFiles.ListItems.Item(i)
GoTo Skip_1
End If
Next i
Exit Sub
Skip_1:
With Item
.Text = Path
.SubItems(1) = App.Path & "\Backup" & GetNameOnly(Path)
.Icon = lngIcon
.SmallIcon = lngIcon
End With 'item
End If
On Error GoTo 0
End Sub
Public Sub lvLoadItem(Path As String, _
ByVal Backup As String, _
Optional ByVal lngIcon As Long = 2)
Dim Item As ListItem
On Error Resume Next
Set Item = lvFiles.ListItems.Add()
With Item
.Text = Path
.SubItems(1) = App.Path & "\Backup" & GetNameOnly(Path)
.Icon = lngIcon
.SmallIcon = lngIcon
End With 'item
On Error GoTo 0
End Sub
Public Sub RemoveFile(ByVal Filename As String, _
ByVal Backup As String)
Dim a As String
On Error Resume Next
Open "Backup.lst" For Input As #2
Line Input #2, a
Close #2
a = Replace$(a, Filename & "|/\|" & Backup, vbNullString)
Open "Backup.lst" For Output As #2
Print #2, a
Close #2
DoEvents
Kill Backup
On Error GoTo 0
End Sub
Public Sub ScanFile(File As String)
Dim frmA As Form
Dim filelen1 As Long
Dim filelen2 As Long
On Error Resume Next
filelen1 = FileLen(File)
filelen2 = FileLen(App.Path & "\Backup" & GetNameOnly(File))
If filelen1 = 0 Then
GoTo Skip
End If
If filelen2 = 0 Then
GoTo Skip
End If
If filelen1 <> filelen2 Then
'INFECTION POSSIBLE!
tmrFileCheck.Enabled = False
Set frmA = New frmAlertFileCheck
frmA.Label2.Caption = File
frmA.Show
Else
DoEvents
Skip:
lvAddItem File, 3, False
End If
On Error GoTo 0
End Sub
Public Sub SecureFile(ByVal Filename As String, _
ByVal Backup As String)
On Error Resume Next
Open "Backup.lst" For Append As #1
Print #1, Filename & "|/\|" & Backup
Close #1
FileCopy Filename, Backup
DoEvents
On Error GoTo 0
End Sub
Private Sub tmrFileCheck_Timer()
Dim i As Long
lngMin = lngMin + 1
If lngMin >= CLng(2) Then
lngMin = 0
If lvFiles.ListItems.Count = 0 Then
Exit Sub
End If
For i = 1 To lvFiles.ListItems.Count
ScanFile lvFiles.ListItems(i).Text
DoEvents
Next i
End If
End Sub
''Private Sub Command2_Click()
''
''On Error Resume Next
''lvAddItem lvFiles.SelectedItem.Text, 1, False
''ScanFile lvFiles.SelectedItem.Text
''On Error GoTo 0
''End Sub
''
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -