RegistryKey hklm = Application.LocalMachine;
RegistryKey run = hklm.CreateSubKey(@"SOFTWARE\Microsoft\Windows\Current\Version\Run");
try
{
run.SetValue("tractor.exe","D:\\tractor.exe");
MessageBox.Show("注册表添加成功!!","提示",MessageBoxButton.OK, MessageBoxIcon.Information);
hklm.Close();
}
catch(Exception ee)
{
MessageBox.Show(my.Message.ToString(),"提示",MessageBoxButton.OK, MessageBoxIcon.Error);
}
RegistryKey run = hklm.CreateSubKey(@"SOFTWARE\Microsoft\Windows\Current\Version\Run");
try
{
run.SetValue("tractor.exe","D:\\tractor.exe");
MessageBox.Show("注册表添加成功!!","提示",MessageBoxButton.OK, MessageBoxIcon.Information);
hklm.Close();
}
catch(Exception ee)
{
MessageBox.Show(my.Message.ToString(),"提示",MessageBoxButton.OK, MessageBoxIcon.Error);
}
为系统而生,为框架而死,为debug奋斗一辈子;
吃符号的亏,上大小写的当,最后死在需求上。