Oppure

Loading
04/05/08 17:18
GrG
Ciao!
Premetto che alcune variabili sotto riportate sono inutilizzate.
Option Explicit
Dim ki As Integer
Dim ver As Boolean
Dim pi As Integer
Dim po As Integer
Dim py As Integer
Dim b As Integer
Dim a(1 To 9999999) As String
Dim i As Long
Dim j As Long
Dim linea(1 To 9999999) As String
Dim arcvir(1 To 9999999) As String
Dim numln As Long
Dim numln2 As Long
Dim numln3 As Long
Dim X As Integer
Dim Y As Integer
Dim filesospetto As String
Dim vir(1 To 9999999) As String
Dim vvv As Boolean

Private Sub confronta()
On Error GoTo ERRORE

Open Text1.Text For Input As #1
Do
numln = numln + 1
Line Input #1, linea(numln)
Loop Until EOF(1) = True
Close #1

Open App.Path & "\archivivirali.txt" For Input As #1
Do
numln2 = numln2 + 1
Line Input #1, arcvir(numln2)

Loop Until EOF(1) = True
Close #1

For i = 1 To numln
For X = 1 To numln2

If arcvir(X) = linea(i) Then
Form5.Picture1.Visible = True
Form5.Check1.Enabled = True
Form5.Check2.Enabled = True
Form5.Check3.Enabled = True
pi = pi - 1
Timer6.Interval = 0
Form5.Show
MsgBox "ATTENZIONE in questo file è stato trovato del codice dannoso o codice che potrebbe appartenere a qualche virus! percorso: " & Text1.Text
Exit Sub
End If
Next X
Next i

j = 0
numln = 0
numln2 = 0
ERRORE:
If Err.Description = "Input oltre la fine del file" Then
MsgBox "ERRORE: Il file potrebbe non avere contenuto!"
MsgBox "Il programma verrà chiuso, ma nella stessa cartella è stato creato un file in cui sono stati scritti i dati che si possono riprendere."
Ricorda
Unload Form1
Unload Form2
Unload Form3
Unload Form4
Unload Form5
ElseIf Err.Description = "" Then
Exit Sub
Else
MsgBox "ERRORE: " & Err.Description, vbExclamation
Ricorda
MsgBox "Il programma verrà chiuso, ma nella stessa cartella è stato creato un file in cui sono stati scritti i dati che si possono riprendere."
Unload Form1
Unload Form2
Unload Form3
Unload Form4
Unload Form5
End If
End Sub

Private Sub Timer6_Timer()
pi = pi + 1
Text2.Text = pi
SetAttr Text1.Text, vbNormal
confronta
If Text2.Text = Text3.Text Then
Timer5.Interval = 0
Timer6.Interval = 0
pi = 0
MsgBox "fine scansione!"
Text2.Text = 0
End If

File1.Selected(pi) = True
End Sub



allora la sub confronta serve per confrontare stringa x stringa di un database con il file da controllare. Solo che ho un problema, dopo che l'antivirus mi trova 2 file "infetti" al 3° file "infetto" che trova però non da l'avvertimento ma da l'errore:
Overflow

cioè supera i limiti di una variabile numerica.
io pensavo che fossero:
numln e numln2 così da integer le ho portate a Long
ma ancora da l'errore quindi come si può rimediare?
Ultima modifica effettuata da GrG 04/05/08 17:19
aaa
04/05/08 17:23
GrG
Post inutile, ho già capito quale era il problema8-|8-|

la variabile da "allungare" era X
quindi:
Dim X as Long

vbb grz lo stesso:-|:-|
aaa
04/05/08 17:27
gantonio
Scusa Gregorio, ma stai scrivendo un antivirus in VB ?
aaa
04/05/08 17:58
GrG
bhè so ke tu pensi (e anke io) ke nn ce la posso fare a fare un antivirus serio ma ci voglio provare...
cmq si vorrei fare un antivirus...8-|
aaa
04/05/08 18:00
gantonio

Ma se lo sai anche tu, perche' non provi a scrivere qualche altro programma (che abbia senso) in VB?
aaa
04/05/08 18:23
GrG
Bè si lo so, però vorrei continuare questo vecchio progetto...Poi in contemporanea creerò altri progr. naturalmente...
aaa