RunWhenStart(false, Application.ProductName, Application.StartupPath + @\"\\MUS.exe\");
/// <summary>
/// 開(kāi)機啟動(dòng)項
/// </summary>
/// <param name=\"Started\">是否啟動(dòng)</param>
/// <param name=\"name\">啟動(dòng)值的名稱(chēng)</param>
/// <param name=\"path\">啟動(dòng)程序的路徑</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 (Exception Err)
{
MessageBox.Show(Err.Message.ToString(), \"MUS\", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} [Page]
else
{
try
{
Run.DeleteValue(name);
HKLM.Close();
}
catch (Exception)
{
//
}
}
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請
點(diǎn)擊舉報。