Wednesday, May 24, 2006

Cho ứng dụng chạy khi startup bằng Registry

//C# code
using Microsoft.Win32;

RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);

//Set the program to start with Windows:
regKey.SetValue(Application.ProductName, Application.ExecutablePath);

//Stop the program from starting with Windows:
regKey.DeleteValue(Application.ProductName);

No comments: