bool chkRun;
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
public MainWindow() { InitializeComponent();
if (rkApp.GetValue("TellMeIP") == null) { // The value doesn't exist, the application is not set to run at startup chkRun = false; MessageBox.Show("NULL"); } else { // The value exists, the application is set to run at startup chkRun = true; } if (chkRun == false) { // Add the value in the registry so that the application runs at startup rkApp.CreateSubKey("TellMeIP"); rkApp.SetValue("TellMeIP", System.Reflection.Assembly.GetExecutingAssembly().Location.ToString()); } else { }
}
Attachment: registry key.zip