VB.Net - Launch app on Windows startup
- by Queops
We all now the tricky folders where your application runs when you publish your VB.NET to other people, but I won't give up on the benefits of the system (auto-update, you know).
Problem is: Program is supposed to startup, or not, with Windows if the user wishes so. I'm saving program preferences into My.Settings. All fine with that. If you debug it it will save the values between sessions. The problem is after deployment.
I installed the program on a testing machine. Application works okay, the settings load, if it's the user launching it by themselfs (using shortcut on desktop for example). Now upon restarting the program does indeed start up as I want it to but the My.Settings don't show up! It's like the config file has been erased. If I close program and re-open by clicking shorcut it loads the settings just fine though. So I wonder what's the problem?
This is the code I use to save the registry key:
regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("ScapeTracker", Chr(34) & Application.ExecutablePath & Chr(34) & " startup")
Does what it's supposed to. The startup parameter is needed so the program knows if it's launched on startup on not (to show up on tray and idle there until user decides to use it).
So the problem is that I can't use the settings upon restart of Windows, so I'm assuming the VB.Net applications have some extra parameters when launching? How can I solve this?