没有合适的资源?快使用搜索试试~ 我知道了~
C# winform利用注册表信息实现开机自动运行软件源代码
5星 · 超过95%的资源 需积分: 35 36 下载量 55 浏览量
2009-12-12
21:15:43
上传
评论 1
收藏 5KB TXT 举报
温馨提示
试读
6页
C# winform利用注册表信息实现开机自动运行软件源代码 C# winform利用注册表信息实现开机自动运行软件源代码
资源推荐
资源详情
资源评论
//=============================================//
//代码类型:函数接口
//名 称:C# winform利用注册表信息实现开机自动运行软件
//功 能:C# winform利用注册表信息实现开机自动运行软件
//原 作 者:林凯
//生成时间:2009年4月27日
//===============================================//
public static void SetRegistryIsStart(bool IsStart)//是否开机运行程序
{
if (IsStart)
{
try
{
string strAssName = Application.StartupPath + @"\" + Application.ProductName + @".exe";
string ShortFileName = Application.ProductName;
RegistryKey rgkRun = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
if (rgkRun == null)
{
rgkRun = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
rgkRun.SetValue(ShortFileName, strAssName);
}
else
{
rgkRun.SetValue(ShortFileName, strAssName);
}
}
catch
{
}
}
else
{
try
{
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true).DeleteValue(Application.ProductName, false);
}
catch
{
}
}
}
利用注册表实现开机自动运行软件源代码如下,功能实现的核心代码如下:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace WindowsApplication1
{
class general
{
static public string ReigstidFileName = "myRegedit";
}
else
{
try
{
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true).DeleteValue(Application.ProductName, false);
}
catch
{
}
}
}
利用注册表实现开机自动运行软件源代码如下,功能实现的核心代码如下:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace WindowsApplication1
{
class general
{
static public string ReigstidFileName = "myRegedit";
剩余5页未读,继续阅读
资源评论
- wxyyxw082013-04-12正想着开发一个这样的小软件,这里的代码可以参考,谢谢。
linkai39
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功