C# 使程序开启是自动运行 C# 开发WINFORM 程序 使开机时自动运行 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 注册表操作 /// </summary> public class WinRegistryKey { //自动运行,keyname 是你自定义的注册表键,可以自己取个名字,filepath是要自动运行的程序路径 public static bool SetAutoRun(string keyName, string filePath) { try { RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); runKey.SetValue(keyName, filePath); runKey.Close(); } catch { return false; } return true; }//取消自动运行 public static bool UnSetAutoRun(string keyName) { try { RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); if (runKey.GetValue(keyName) != null) { runKey.DeleteValue(keyName); } runKey.Close(); } catch { return false; } return true; } } 求助关于WinForm绘图 c# 类 与 java类的区别 更改RichTextBox中选中文本字体的问题 Oledbconnection执行Open时出错,求教阿-急,在线等 在C#如何生成动态SQl语句 求救!!郁闷。。公司要把考勤机改成售饭系统,系统要自己开发,莫不着头脑啊!! ¥取得本地驱动器后,如何判断他们是光驱、软驱还是硬盘呢?¥ 急!急!急!急!急!急!救救我的朋友吧! 求access导入oracle数据库程序!急急!!! 怎样弹出massegebox 如何编写一个 windows 服务程序 bootstrapper packages什么意思?
/// <summary>
/// 注册表操作
/// </summary>
public class WinRegistryKey
{
//自动运行,keyname 是你自定义的注册表键,可以自己取个名字,filepath是要自动运行的程序路径
public static bool SetAutoRun(string keyName, string filePath)
{
try
{
RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
runKey.SetValue(keyName, filePath);
runKey.Close();
}
catch
{
return false;
}
return true;
}//取消自动运行
public static bool UnSetAutoRun(string keyName)
{
try
{
RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); if (runKey.GetValue(keyName) != null)
{
runKey.DeleteValue(keyName);
}
runKey.Close();
}
catch
{
return false;
}
return true;
} }