Kod: Zaznacz cały
public static void RunOnWindowsStart(Boolean turnOn)
{
try
{
RegistryKey rKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rKey.DeleteValue(Application.ProductName, false);
if (turnOn)
{
rKey.SetValue(Application.ProductName, Application.ExecutablePath, RegistryValueKind.String);
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
Te MessageBoxy są takie konieczne czy nie jest to aż takie konieczne? Poza tym to dopuściłem się pewnych błędów odnośnie tego kodu? Jak coś to Visual jest już sprawny.