jinyuttt

导航

搜索启动项c#

引入空间名称:Microsoft.win32

添加listbox。

代码:

  private void Form1_Load(object sender, EventArgs e)
        {
             foreach (string name in GetRegistName())
            {
                 listBox1.Items.Add( name + ":" + GetRegistData(name) );
            }

        }  
            private string GetRegistData(string name)//程序安装位置
        {
            string registData;
            RegistryKey hkml = Registry.LocalMachine;           
            RegistryKey aimdir = hkml.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
            registData = aimdir.GetValue(name).ToString();
            return registData;
        }

        private string[] GetRegistName()//名称
        {
           
            RegistryKey hkml = Registry.LocalMachine;
            RegistryKey aimdir = hkml.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
            return aimdir.GetValueNames();
        }

posted on 2010-09-04 22:48  代码苦行僧  阅读(373)  评论(0编辑  收藏  举报