How do I get the user to choose whether the system (system tray c #) will start with the OS or not through the installation in WizardSetup (Visual Studio 2010)?
How do I get the user to choose whether the system (system tray c #) will start with the OS or not through the installation in WizardSetup (Visual Studio 2010)?
There is Registry Editor where you can register keys. What you need to do is to add a startup key to it in the following path: SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run
But the Value to include in it should be the path to your application, I'm not sure ...
It has a very explanatory link on how to use it:
setup-and-deployment-in -visual-studio-2010 Look for the part of the Registry editor in the link;
You can also do it via code within your application :
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
key.SetValue("Your Application Name", @"Your application path.exe");
There is InstallShield that is not from Microsoft but is one of the best that exists. In visual studio you have for free the limited version, where it does not support advanced options like the one that you are requiring
Good evening complementing the above answer, Is there this method I use in C # with it you can put to your application start with Windows or even remove it .. like this you can by that setting in the application to start with Windows. The method is this:
public static void SetStartup(bool OnOff)
{
try{
//Nome a ser exibido no registro ou quando Der MSCONFIG - Pode Alterar
string appName = "SAT Manager - 4Way Systems";
//Diretorio da chave do Registro NAO ALTERAR
string runKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
//Abre o registro
RegistryKey startupKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
//Valida se vai incluir o iniciar com o Windows ou remover
if (OnOff)//Iniciar
{
if (startupKey.GetValue(appName) == null)
{
// Add startup reg key
startupKey.SetValue(appName, @""""+ Application.ExecutablePath.ToString() +@"""");
startupKey.Close();
}
}
else//Nao iniciar mais
{
// remove startup
startupKey = Registry.LocalMachine.OpenSubKey(runKey, true);
startupKey.DeleteValue(appName, false);
startupKey.Close();
}
}catch(Exception ex){
MessageBox.Show(ex.Message);
}
}
In some cases the application has to be run as Administrator to access the registry.