/// & Lt; summary & gt;
/// Start item
/// & Lt;/Summary & gt;
/// & Lt; Param name = & quot; started & quot; & gt; start or not & lt;/Param & gt;
/// & Lt; Param name = & quot; Name & quot; & gt; Name of the startup value & lt;/Param & gt;
/// & Lt; Param name = & quot; Path & quot; & gt; StartProgramPath & lt;/Param & gt;
/// <Summary>
/// Start item
/// </Summary>
/// <Param name = "started"> Start or not </param>
/// <Param name = "name"> name of the startup value </param>
/// <Param name = "path"> path of the Startup Program </param>
Public static void runwhenstart (bool started, string name, string path)
{
Registrykey HKLM = registry. localmachine;
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
{
}
}
}