Run the application at Windows startup?

You could try copying a shortcut to your application into the startup folder instead of adding things to the registry. You can get the path with Environment.SpecialFolder. Startup This is available in all .

Net frameworks since 1.1.

You could try copying a shortcut to your application into the startup folder instead of adding things to the registry. You can get the path with Environment.SpecialFolder.Startup. This is available in all .

Net frameworks since 1.1. Alternatively, maybe this site will be helpful to you, it lists a lot of the different ways you can get an application to auto-start.

Code is here(win form app): using System; using System.Collections. Generic; using System. ComponentModel; using System.

Data; using System. Drawing; using System. Text; using System.Windows.

Forms; using Microsoft. Win32; namespace RunAtStartup { public partial class frmStartup : Form { // The path to the key where Windows looks for startup applications RegistryKey rkApp = Registry.CurrentUser. OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); public frmStartup() { InitializeComponent(); // Check to see the current state (running at startup or not) if (rkApp.

GetValue("MyApp") == null) { // The value doesn't exist, the application is not set to run at startup chkRun. Checked = false; } else { // The value exists, the application is set to run at startup chkRun. Checked = true; } } private void btnOk_Click(object sender, EventArgs e) { if (chkRun.

Checked) { // Add the value in the registry so that the application runs at startup rkApp. SetValue("MyApp", Application.ExecutablePath.ToString()); } else { // Remove the value from the registry so that the application doesn't start rkApp. DeleteValue("MyApp", false); } } } }.

I think there is a specific Win32 API call which takes the application path and puts it in the registry automatically for you in the proper location, I've used it in the past but I don't remember the function name anymore.

Try this code private void RegisterInStartup(bool isChecked) { RegistryKey registryKey = Registry.CurrentUser. OpenSubKey ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); if (isChecked) { registryKey. SetValue("ApplicationName", Application.

ExecutablePath); } else { registryKey. DeleteValue("ApplicationName"); } } Source : http://www.dotnetthoughts.net/2010/09/26/run-the-application-at-windows-startup.

OK here are my 2 cents: try passing path with each backslash as double backslash. I have found sometimes calling WIN API requires that.

1 -1 because it isn't WIN API that requires that, it is how languages like C# and C++ interpret the backslash character in a string. – AAT Mar 5 at 12:02 You will be surprised my friend that sometimes they also need it. I will post when I find the example - it was a while back.

– Aliostad Mar 5 at 13:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions