当前位置:编程学习 > C#/ASP.NET >>

搜索启动项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(@"SOFTWAREMicrosoftWindowsCurrentVersionRun", true);
            registData = aimdir.GetValue(name).ToString();
            return registData;
        }

        private string[] GetRegistName()//名称
        {
           
            RegistryKey hkml = Registry.LocalMachine;
            RegistryKey aimdir = hkml.OpenSubKey(@"SOFTWAREMicrosoftWindowsCurrentVersionRun", true);
            return aimdir.GetValueNames();
        }

    
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,