start at windows startup

This commit is contained in:
pypy
2020-03-21 18:00:47 +09:00
parent d1c84a8f25
commit 81694ec60a
3 changed files with 33 additions and 3 deletions
+22
View File
@@ -134,5 +134,27 @@ namespace VRCX
{
return CpuMonitor.CpuUsage;
}
public void SetStartup(bool enabled)
{
try
{
using (var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
{
if (enabled)
{
var path = Application.ExecutablePath;
key.SetValue("VRCX", $"\"{path}\" --startup");
}
else
{
key.DeleteValue("VRCX", false);
}
}
}
catch
{
}
}
}
}