Kartikey Sapra
Basic code to add your program to the registry.
First it copies itself to the C:\ drive.
Then it adds that copy to the startup.

You will need this at the top of your code:
Code:
Imports Microsoft.Win32


Code:
Code:
Dim appname As String = IO.Path.GetFileName(Application.ExecutablePath)

My.Computer.FileSystem.CopyFile(Application.ExecutablePath, "C:\" & appname, True)

Dim regKey As Microsoft.Win32.RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue(appname, "C:\")
regKey.Close()
Labels:
0 Responses

Post a Comment