不知道你的意思Vista/Windows7,但我在WPF应用程序中使用了下面的代码,它可以工作XP/Vista/Win7.
void InstallMeOnStartUp()
{
try
{
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
Assembly curAssembly = Assembly.GetExecutingAssembly();
key.SetValue(curAssembly.GetName().Name, curAssembly.Location);
}
catch{
}
}
Run Code Online (Sandbox Code Playgroud)
请告诉我,如果这不是您要搜索的内容.
| 归档时间: |
|
| 查看次数: |
6378 次 |
| 最近记录: |