zoukankan      html  css  js  c++  java
  • 写注册表使程序随开机自动启动

    using Microsoft.Win32;

    public static void RunWhenStart(bool Started, string name, string path)

            {

                RegistryKey HKLM = Registry.LocalMachine;

                RegistryKey Run = HKLM.CreateSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\");

                if (Started == true)

                {

                    try

                    {

                        Run.SetValue(name, path);

                        HKLM.Close();

                    }

                    catch (Exception Err)

                    {

                        MessageBox.Show(Err.Message.ToString(), @"IncMonitor\", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    }

                }

                else

                {

                    try

                    {

                        Run.DeleteValue(name);

                        HKLM.Close();

                    }

                    catch (Exception)

                    {

                        //

                    }

                }

            }

  • 相关阅读:
    selenium 浏览器操作
    selenium 4.0新特性及新旧api对比
    Selenium123介绍
    selenium元素定位(三) css定位方法
    selenium 安装和启动
    Selenium元素定位(一)30+1+5种方式
    软件开发经验收集
    spring+hibernate架构中Dao访问数据库的几种方法
    某励志书4
    PHP的Foreach
  • 原文地址:https://www.cnblogs.com/sungcong/p/1909010.html
Copyright © 2011-2022 走看看