Use the registry to record the name (key) and full path (value) of your program.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Note. This will load when the user logs in, not when the system starts. You need a service, as Joel said, to do this.
In C # .net do the following:
public string GetRegistryValue(String key)
{
return Convert.ToString(Registry.GetValue (@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", key, ""));
}
public void SetRegistryValue(String key, String value)
{
Registry.SetValue (@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", key, value);
}
VB.net code is very similar.
source
share