There was this issue a long time ago.
first you need to set registry in HKCU\Software\Microsoft\Windows\CurrentVersion\Run
make sure you have enough permissions!:
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
{
key.SetValue(AppName, Application.ExecutablePath);
}
Then follow the steps from this post:
- Add it to the current user's Startup folder. This requires the least permissions for your app to run, and gives the user the most
control and feedback of what's going on. The down-side is that it's a
little more difficult determining whether to show the checkbox already
checked next time they view that screen in your program.
- Add it to the
HKey_Current_User\Software\Microsoft\Windows\CurrentVersion\Run
registry key. The only problem here is that it requires write access
to the registry, which isn't always available.
- Create a Scheduled Task that triggers on User Login
- Add it to the
HKey_Local_Machine\Software\Microsoft\Windows\CurrentVersion\Run
registry key. The only problem here is that it requires write access
to the registry, which isn't always available.
- Set it up as a windows service. Only do this if you really mean it, and you know for sure you want to run this program for all
users on the computer.