Se trata de una pequeña aplicacion que permite activar y desactivar el Firewall de Windows7 por programa.
Form1
Public Class Form1
Private Sub ButtonFIREWALL_Click(sender As Object, e As EventArgs) Handles ButtonFIREWALL.Click
If ButtonFIREWALL.BackColor = Color.Black Then
Try
Const NET_FW_PROFILE2_DOMAIN = 1
Const NET_FW_PROFILE2_PRIVATE = 2
Const NET_FW_PROFILE2_PUBLIC = 4
Dim fwPolicy2
fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_DOMAIN) = False
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PRIVATE) = False
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PUBLIC) = False
ButtonFIREWALL.BackColor = Color.Red
MsgBox("FIREWALL DESACTIVADO")
Catch ex As Exception
MsgBox("EJECUTAR COMO ADMINISTRADOR")
Me.Close()
End Try
Else
Try
Const NET_FW_PROFILE2_DOMAIN = 1
Const NET_FW_PROFILE2_PRIVATE = 2
Const NET_FW_PROFILE2_PUBLIC = 4
Dim fwPolicy2
fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_DOMAIN) = True
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PRIVATE) = True
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PUBLIC) = True
ButtonFIREWALL.BackColor = Color.Black
MsgBox("FIREWALL RE-ACTIVADO")
Catch ex As Exception
End Try
End If
End Sub
Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
If ButtonFIREWALL.BackColor = Color.Red Then
Try
Const NET_FW_PROFILE2_DOMAIN = 1
Const NET_FW_PROFILE2_PRIVATE = 2
Const NET_FW_PROFILE2_PUBLIC = 4
Dim fwPolicy2
fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_DOMAIN) = True
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PRIVATE) = True
fwPolicy2.FirewallEnabled(NET_FW_PROFILE2_PUBLIC) = True
Catch ex As Exception
End Try
End If
End Sub
End Class
Excelente blog gracias
ResponderEliminarHola: Muchas gracias. Saludos
EliminarHola me gusta mucho tu blogs
ResponderEliminarsabe como hacer un Tv player
Hola: Si, es un tema interesante hare una aplicación. Aunque el verdadero problema es disponer de los links para acceder a las emisoras de televisión. Subire algo la próxima semana. Saludos
Eliminaresto no funciona si tienes un antivirus que no sea de windows.
ResponderEliminarso funciona con windows firewall