Skip to content

Instantly share code, notes, and snippets.

@emad-elsaid
Created February 15, 2011 14:50
Show Gist options
  • Select an option

  • Save emad-elsaid/827606 to your computer and use it in GitHub Desktop.

Select an option

Save emad-elsaid/827606 to your computer and use it in GitHub Desktop.
/*first: you need to add the following to the head of your file to link with Windows library.*/
using Microsoft.Win32;
/* second you'll nedd to make a new object of the folder of current user registery */
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
/* third you have to add your application key : name and path */
rkApp.SetValue("HappyV", Application.ExecutablePath.ToString());
/* that line is to remove your application from the registery */
rkApp.DeleteValue("HappyV", false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment