Guest User

Untitled

a guest
Oct 23rd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. My.Computer.Registry.SetValue("HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun", "FILENAME", "FILEPATH")
  2.  
  3. Public Sub AddToStartup(Optional appCommand As String = "")
  4. Dim applicationName As String = Application.ProductName
  5. Dim applicationPath As String = Application.ExecutablePath
  6. Dim regKey As Microsoft.Win32.RegistryKey
  7. regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWAREMicrosoftWindowsCurrentVersionRun", True)
  8. regKey.SetValue(applicationName, """" & applicationPath & """" & appCommand)
  9. regKey.Close()
  10. End Sub
  11.  
  12. Public Sub RemoveFromStartup()
  13. Dim applicationName As String = Application.ProductName
  14. Dim regKey As Microsoft.Win32.RegistryKey
  15. regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWAREMicrosoftWindowsCurrentVersionRun", True)
  16. regKey.DeleteValue(applicationName, False)
  17. regKey.Close()
  18. End Sub
Add Comment
Please, Sign In to add comment