时空萌新
- 阅读权限
- 10
- 在线时间
- 35 小时
- 注册时间
- 2017-7-28
- 最后登录
- 2017-10-19
- UID
- 156
- 时空币
- 136
- 时之结晶
- 53
- 最后登录
- 2017-10-19
|
本帖最后由 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();
- }
- }
- }
复制代码
{:4_91:}
以上只是部分代码 {:4_115:} 全代码回复后获取下载地址:
|
|