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
MAC (Messenger Advertising Cleaner) - Form1.vb

Form1.vb

Caricato da: A_butta
Scarica il programma completo

  1. Public Class Form1
  2.     Dim Path As String = (My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData)(0) + ":\Windows\system32\drivers\etc\hosts"
  3.     Dim Controllo As Boolean = False
  4.     Dim Com As String = "127.0.0.1 rad.msn.com"
  5.  
  6.     Private Sub ControlloComando()
  7.         Controllo = False
  8.         Dim Leggi As New IO.StreamReader(Path)
  9.         Dim Stringa As String = Nothing
  10.         While Not (Leggi.EndOfStream)
  11.             If Com = Leggi.ReadLine Then
  12.                 Controllo = True
  13.             End If
  14.         End While
  15.         Leggi.Close()
  16.         If Controllo Then
  17.             Button1.Enabled = False
  18.             Button2.Enabled = True
  19.         Else
  20.             Button2.Enabled = False
  21.             Button1.Enabled = True
  22.         End If
  23.     End Sub
  24.  
  25.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  26.         Dim Leggi As New IO.StreamWriter(Path, True)
  27.         Leggi.WriteLine(Com)
  28.         Leggi.Close()
  29.         ControlloComando()
  30.     End Sub
  31.  
  32.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  33.         Dim Testo As String = My.Computer.FileSystem.ReadAllText(Path)
  34.         Testo = Testo.Replace(Com, "")
  35.         My.Computer.FileSystem.WriteAllText(Path, Testo, False)
  36.        
  37.         ControlloComando()
  38.     End Sub
  39.  
  40.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  41.         ControlloComando()
  42.     End Sub
  43.  
  44.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  45.         ControlloComando()
  46.     End Sub
  47. End Class