Thursday, June 16, 2011

C# how to Run the application at Windows startup


private void RegisterInStartup(bool Checked)
{
    RegistryKey registryValue= Registry.CurrentUser.OpenSubKey
            ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
    if (Checked))
    {
        registryKey.SetValue("startupApplication", Application.ExecutablePath);
    }
    else
    {
        registryKey.DeleteValue("startupApplication");
    }
}

2 comments:

  1. In which place i write this coding

    ReplyDelete
  2. create a windows application in visual studio. there you can use this code to add your application to start at the windows startup.

    ReplyDelete

Thank you for Commenting Will reply soon ......

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...