[Csharp]
# Region
/// <Summary>
/// Start item
/// </Summary>
/// <Param name = "Started"> Start or not </param>
/// <Param name = "name"> name of the startup value </param>
/// <Param name = "path"> Application. ExecutablePath </param>
Public static void RunWhenStart (bool Started, string name, string path)
{
Microsoft. Win32.RegistryKey HKLM = Microsoft. Win32.Registry. LocalMachine;
Microsoft. Win32.RegistryKey Run = HKLM. CreateSubKey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run ");
If (Started = true)
{
Try
{
Run. SetValue (name, path );
HKLM. Close ();
}
Catch {}
}
Else
{
Try
{
Run. DeleteValue (name );
HKLM. Close ();
}
Catch {}
}
}
# Endregion
# Region
/// <Summary>
/// Start item
/// </Summary>
/// <Param name = "Started"> Start or not </param>
/// <Param name = "name"> name of the startup value </param>
/// <Param name = "path"> Application. ExecutablePath </param>
Public static void RunWhenStart (bool Started, string name, string path)
{
Microsoft. Win32.RegistryKey HKLM = Microsoft. Win32.Registry. LocalMachine;
Microsoft. Win32.RegistryKey Run = HKLM. CreateSubKey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run ");
If (Started = true)
{
Try
{
Run. SetValue (name, path );
HKLM. Close ();
}
Catch {}
}
Else
{
Try
{
Run. DeleteValue (name );
HKLM. Close ();
}
Catch {}
}
}
# Endregion