ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

开机自启动

开机自启动

代码展示:

        #region 开机启动/// <summary>  /// 修改程序在注册表中的键值  /// </summary>  /// <param name="isAuto">true:开机启动,false:不开机自启</param> private void AutoStart(bool isAuto = true){if (isAuto == true){RegistryKey R_local = Registry.CurrentUser;RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");R_run.SetValue("PressurizationStationPro", System.Windows.Forms.Application.ExecutablePath);R_run.Close();R_local.Close();}else{RegistryKey R_local = Registry.CurrentUser;RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");R_run.DeleteValue("PressurizationStationPro", false);R_run.Close();R_local.Close();}}#endregion
返回列表