Startup Program: Setting Application Launch at System Boot
The challenge of automatically launching an application at Windows startup can be tackled effectively. A user sought guidance in achieving this from within a C# application, featuring a user-configurable checkbox.
The solution requires a careful manipulation of the registry. The user opted for a registry key addition to the current user's "Run" folder, as suggested by Joel. The code snippet below showcases the implementation:
using Microsoft.Win32; private void SetStartup() { RegistryKey rk = Registry.CurrentUser.OpenSubKey ("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); if (chkStartUp.Checked) rk.SetValue(AppName, Application.ExecutablePath); else rk.DeleteValue(AppName,false); }
In this code:
The above is the detailed content of How Can I Make My C# Application Launch Automatically at Windows Startup?. For more information, please follow other related articles on the PHP Chinese website!