Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have added this code for run at start up

C#
public static void AddApplicationToStartup()
{
    using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
    {
        key.SetValue("My Program", "\"" + Application.ExecutablePath + "\"");
    }
}


and i have called this function at the very first line of Main function. the problem is this will run every time. but how can we check that this application is already added to registery??
Posted

1 solution

If you can write to some part of the registry, it's quite apparent that you can read it, too. Look more thoroughly at the Registry class you are already using.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900