Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My.Computer.Registry.SetValue("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun", "FILENAME", "FILEPATH")
- Public Sub AddToStartup(Optional appCommand As String = "")
- Dim applicationName As String = Application.ProductName
- Dim applicationPath As String = Application.ExecutablePath
- Dim regKey As Microsoft.Win32.RegistryKey
- regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWAREMicrosoftWindowsCurrentVersionRun", True)
- regKey.SetValue(applicationName, """" & applicationPath & """" & appCommand)
- regKey.Close()
- End Sub
- Public Sub RemoveFromStartup()
- Dim applicationName As String = Application.ProductName
- Dim regKey As Microsoft.Win32.RegistryKey
- regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWAREMicrosoftWindowsCurrentVersionRun", True)
- regKey.DeleteValue(applicationName, False)
- regKey.Close()
- End Sub
Add Comment
Please, Sign In to add comment