程序自启动的问题

前段时间在做一个截图工具时,需要设置开机自启。后来发现程序不能实现自启动,反而让我有了一些新收获。看下面的的代码,这便是我原来设置开机自启的代码: //采用IO的方式设置开机自启 RegistryKey hklm = Registry.LocalMachine; RegistryKey ziqi; private void button1_Click(object sender, EventArgs e)        {            FileInfo fileinfo = new FileInfo("WindowsFormsApplication1.exe");            ziqi = hklm.CreateSubKey(@"software\microsoft\windows\CurrentVersion\run");            ziqi.SetValue("test", (object)fileinfo.FullName, RegistryValueKind.String);            ziqi.Clo

posted @ 2010-05-07 18:43  橘子西瓜  阅读(257)  评论(0编辑  收藏  举报