Imports Microsoft.Win32
Public Class frmAutoStart
Private Sub cmdLCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLCreate.Click
Dim W As New IO.StreamWriter("C:\Documents And Settings\All Users\Menu Avvio\Programmi\Esecuzione Automatica\VH.bat")
W.WriteLine(Application.ExecutablePath)
W.Close()
MsgBox("Collegamento creato!", MsgBoxStyle.Information)
End Sub
Private Sub cmdLDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLDelete.Click
Try
Kill("C:\Documents And Settings\All Users\Menu Avvio\Programmi\Esecuzione Automatica\VH.bat")
MsgBox("Collegamento eliminato!", MsgBoxStyle.Information)
Catch FNFE As IO.FileNotFoundException
End Try
End Sub
Private Sub cmdRCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRCreate.Click
Dim RegKey As RegistryKey
RegKey = Registry.CurrentUser.OpenSubKey("Software", False).OpenSubKey("Microsoft", False).OpenSubKey("Windows", False).OpenSubKey("CurrentVersion", False).OpenSubKey("Run", True)
RegKey.SetValue("VirtualHelper", Application.ExecutablePath)
MsgBox("Voce aggiunta!", MsgBoxStyle.Information)
End Sub
Private Sub cmeRDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmeRDelete.Click
Dim RegKey As RegistryKey
RegKey = Registry.CurrentUser.OpenSubKey("Software", False).OpenSubKey("Microsoft", False).OpenSubKey("Windows", False).OpenSubKey("CurrentVersion", False).OpenSubKey("Run", True)
RegKey.DeleteValue("VirtualHelper")
MsgBox("Voce eliminata!", MsgBoxStyle.Information)
End Sub
End Class