Sailors.NET
我的一切皆因互联网而改变,现在我也想学学改变互联网。
http://community.csdn.net/Expert/topic/4327/4327795.xml?temp=.1075556


http://community.csdn.net/Expert/topic/4255/4255732.xml?temp=.9858362

  /// <summary>
  /// 设置能否开机自动运行状态
  /// </summary>
  /// <param name="IsAuto">是否能够自动运行</param>
  public void SetAutoExec(bool IsAuto)
  {
   RegistryKey Reg =Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",true);
   if(IsAuto)
   {
    string sFilePath = Application.ExecutablePath;
    Reg.SetValue("名字",sFilePath);
   }
   else
   {
    if(IsAuto==false) Reg.DeleteValue("名字");
   }
  }
posted on 2006-04-30 16:48  Sailors.NET  阅读(322)  评论(0)    收藏  举报