C#WinForm开机启动程序下载
本帖最后由 HelloWord 于 2017-8-16 18:11 编辑using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 开机自动启动
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked) //设置开机自启动
{
MessageBox.Show("设置开机自启动,需要修改注册表", "提示");
string path = Application.ExecutablePath;
RegistryKey rk = Registry.LocalMachine;
RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
rk2.SetValue("JcShutdown", path);
rk2.Close();
rk.Close();
}
else //取消开机自启动
{
MessageBox.Show("取消开机自启动,需要修改注册表", "提示");
string path = Application.ExecutablePath;
RegistryKey rk = Registry.LocalMachine;
RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
rk2.DeleteValue("JcShutdown", false);
rk2.Close();
rk.Close();
}
}
private void Form1_Load(object sender, EventArgs e)
{
string path = Application.ExecutablePath;
RegistryKey rk = Registry.LocalMachine;
RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
rk2.DeleteValue("rizhi", false);
rk2.Close();
rk.Close();
}
}
}
HelloWord出品必属精品
{:4_91:}
以上只是部分代码{:4_115:}全代码回复后获取下载地址:**** Hidden Message *****
回帖是美德,看贴必回 回帖是美德,看贴必回 回的人少,我来小顶一下 啥也不说了,感谢楼主分享哇! 回帖是美德,看贴必回
页:
[1]