Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Problemi con le variabili.
Forum - Visual Basic 6 - Problemi con le variabili.

Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 19:18
Domenica, 04/05/2008
Ciao!
Premetto che alcune variabili sotto riportate sono inutilizzate.
Codice sorgente - presumibilmente VB.NET

  1. Option Explicit
  2. Dim ki As Integer
  3. Dim ver As Boolean
  4. Dim pi As Integer
  5. Dim po As Integer
  6. Dim py As Integer
  7. Dim b As Integer
  8. Dim a(1 To 9999999) As String
  9. Dim i As Long
  10. Dim j As Long
  11. Dim linea(1 To 9999999) As String
  12. Dim arcvir(1 To 9999999) As String
  13. Dim numln As Long
  14. Dim numln2 As Long
  15. Dim numln3 As Long
  16. Dim X As Integer
  17. Dim Y As Integer
  18. Dim filesospetto As String
  19. Dim vir(1 To 9999999) As String
  20. Dim vvv As Boolean
  21.  
  22. Private Sub confronta()
  23. On Error GoTo ERRORE
  24.  
  25. Open Text1.Text For Input As #1
  26. Do
  27. numln = numln + 1
  28. Line Input #1, linea(numln)
  29. Loop Until EOF(1) = True
  30. Close #1
  31.  
  32. Open App.Path & "\archivivirali.txt" For Input As #1
  33. Do
  34. numln2 = numln2 + 1
  35. Line Input #1, arcvir(numln2)
  36.  
  37. Loop Until EOF(1) = True
  38. Close #1
  39.  
  40. For i = 1 To numln
  41. For X = 1 To numln2
  42.  
  43. If arcvir(X) = linea(i) Then
  44. Form5.Picture1.Visible = True
  45. Form5.Check1.Enabled = True
  46. Form5.Check2.Enabled = True
  47. Form5.Check3.Enabled = True
  48. pi = pi - 1
  49. Timer6.Interval = 0
  50. Form5.Show
  51. MsgBox "ATTENZIONE in questo file è stato trovato del codice dannoso o codice che potrebbe appartenere a qualche virus! percorso: " & Text1.Text
  52. Exit Sub
  53. End If
  54. Next X
  55. Next i
  56.  
  57. j = 0
  58. numln = 0
  59. numln2 = 0
  60. ERRORE:
  61. If Err.Description = "Input oltre la fine del file" Then
  62. MsgBox "ERRORE: Il file potrebbe non avere contenuto!"
  63. MsgBox "Il programma verrà chiuso, ma nella stessa cartella è stato creato un file in cui sono stati scritti i dati che si possono riprendere."
  64. Ricorda
  65. Unload Form1
  66. Unload Form2
  67. Unload Form3
  68. Unload Form4
  69. Unload Form5
  70. ElseIf Err.Description = "" Then
  71. Exit Sub
  72. Else
  73. MsgBox "ERRORE: " & Err.Description, vbExclamation
  74. Ricorda
  75. MsgBox "Il programma verrà chiuso, ma nella stessa cartella è stato creato un file in cui sono stati scritti i dati che si possono riprendere."
  76. Unload Form1
  77. Unload Form2
  78. Unload Form3
  79. Unload Form4
  80. Unload Form5
  81. End If
  82. End Sub
  83.  
  84. Private Sub Timer6_Timer()
  85. pi = pi + 1
  86. Text2.Text = pi
  87. SetAttr Text1.Text, vbNormal
  88. confronta
  89. If Text2.Text = Text3.Text Then
  90. Timer5.Interval = 0
  91. Timer6.Interval = 0
  92. pi = 0
  93. MsgBox "fine scansione!"
  94. Text2.Text = 0
  95. End If
  96.  
  97. File1.Selected(pi) = True
  98. 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 il 04/05/2008 alle 19:19
PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 19:23
Domenica, 04/05/2008
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:-|:-|

PM Quote
Avatar
gantonio (Normal User)
Guru^2


Messaggi: 1532
Iscritto: 09/09/2007

Segnala al moderatore
Postato alle 19:27
Domenica, 04/05/2008
Scusa Gregorio, ma stai scrivendo un antivirus in VB ?

PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 19:58
Domenica, 04/05/2008
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-|

PM Quote
Avatar
gantonio (Normal User)
Guru^2


Messaggi: 1532
Iscritto: 09/09/2007

Segnala al moderatore
Postato alle 20:00
Domenica, 04/05/2008

Ma se lo sai anche tu, perche' non provi a scrivere qualche altro programma (che abbia senso) in VB?

PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 20:23
Domenica, 04/05/2008
Bè si lo so, però vorrei continuare questo vecchio progetto...Poi in contemporanea creerò altri progr. naturalmente...

PM Quote