顶者有分!WinForms登录窗体如何利用注册表实现自动登录 就是利用注册表 实现自动运行登录按钮,最好有源代码可以参考 拜托了。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是要程序自动运行呢还是自动登录呢自动运行 string R_startPath = Application.ExecutablePath; if (checkBox1.Checked == true) { RegistryKey R_local = Registry.LocalMachine; RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); R_run.SetValue("BirthdayTipF", R_startPath); R_run.Close(); R_local.Close(); MessageBox.Show("成功!"); } else { try { RegistryKey R_local = Registry.LocalMachine; RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); R_run.DeleteValue("BirthdayTipF", false); R_run.Close(); R_local.Close(); MessageBox.Show("成功!"); } catch (Exception ex) { MessageBox.Show("您需要管理员权限修改", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }自动登录就不说了 R_run.SetValue("BirthdayTipF", R_startPath);参数一:程序名参数二:路径 GDI+绘图 打印机的安全权限设置 用户自定义控件问题 求DevExpress 控件,或Reporting Services 中关于格式化输出的问题 PB能否调用.net生成的动态连接库? 再问,C#调用C++的dll不能正常的返回 急问(正则表达式) filesystemwatcher组件的一个问题--只要解决问题肯定揭贴 关于Singleton模式的讨论 那里有代码可以实现阳历,农历互相转换? 对c#中枚举的一些总结 C# winform控件notifyIcon如何使用
自动运行
string R_startPath = Application.ExecutablePath;
if (checkBox1.Checked == true)
{
RegistryKey R_local = Registry.LocalMachine;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.SetValue("BirthdayTipF", R_startPath);
R_run.Close();
R_local.Close();
MessageBox.Show("成功!");
}
else
{
try
{
RegistryKey R_local = Registry.LocalMachine;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.DeleteValue("BirthdayTipF", false);
R_run.Close();
R_local.Close();
MessageBox.Show("成功!");
}
catch (Exception ex)
{
MessageBox.Show("您需要管理员权限修改", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw;
} }
自动登录就不说了
参数一:程序名
参数二:路径