码迷,mamicode.com
首页 > Windows程序 > 详细

C# Winform 注册程序开机启动

时间:2014-07-16 19:43:49      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:winform   style   blog   color   os   art   

1 开机启动

public static bool SetAutoRun(string keyName, string filePath)
{
    try
    {
        RegistryKey Local= Registry.LocalMachine;
        RegistryKey runKey =Local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\");
        runKey.SetValue(keyName, filePath);
        Local.Close();
    }
    catch
    {
        return false;
    }
    return true;
}

SetAutoRun("exeName", Application.StartupPath + "\\step.exe");

 

C# Winform 注册程序开机启动,布布扣,bubuko.com

C# Winform 注册程序开机启动

标签:winform   style   blog   color   os   art   

原文地址:http://www.cnblogs.com/gordensong/p/3837390.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!