by VB_Fanatic (2 Submissions)
Category: Encryption
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 10th August 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
AntiVirus program example...
'Add 1 label, 1 text and 2 commandbuttons to the form...
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.CancelError = True
CommonDialog1.DialogTitle = "Browse to the file to scan..."
CommonDialog1.Filter = "All files (*.*)|*.*"
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
On Error Resume Next
If Text1.Text = "" Then
MsgBox "Please select a file to scan...", vbExclamation, "Error occured"
Else
Dim fileBufferLen, OByte As Byte, FileStrs As String
Open Text1.Text For Binary As #1
DoEvents
Do While Not EOF(1)
DoEvents
Get #1, , OByte
FileStrs = FileStrs & Chr(OByte)
Loop
Close #1
If InStr(1, FileStrs, "VIRUS STRING GOES HERE - Heres a string from Win32.Klez.H worm: XËeè3ÿ3ÛƒMüÿ‹uØ;ßt´VSÿuäÿuÜÿu - Remember to avoid darkboxes, because they're only causing troubles...", vbTextCompare) Then
Label1.Caption = Text1.Text & " is infected with the Win32.Klez.H@mm worm!"
Else
Label1.Caption = "No infection found!"
End If
fileBufferLen = Len(FileStrs)
FileStrs = Space(fileBufferLen)
End If
End Sub