首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么让程序能够开机自动运行?

2012-03-31 
如何让程序能够开机自动运行??这个是应该写注册表么??就30分了,还望不吝赐教啊!![解决办法]C# code//此方

如何让程序能够开机自动运行??
这个是应该写注册表么??

就30分了,还望不吝赐教啊!!

[解决办法]

C# code
//此方法把启动项加载到注册表中//获得应用程序路径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);//此删除注册表中启动项//获得应用程序名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.DeleteValue(ShortFileName, false);
[解决办法]
探讨
C# code
//此方法把启动项加载到注册表中

//获得应用程序路径
string strAssName = Application.StartupPath + @"\" + Application.ProductName + @".exe";
//获得应用程序名
string ShortFileName = Application.ProductName;

Registry……

[解决办法]
探讨
C# code
//此方法把启动项加载到注册表中

//获得应用程序路径
string strAssName = Application.StartupPath + @"\" + Application.ProductName + @".exe";
//获得应用程序名
string ShortFileName = Application.ProductName;

Registry……

热点排行