delphi 遍历注册表


本文整理自网络,侵删。

 下面程序是读出windows中所有的已安装的程序.你自己看一下,很容易的.   
  uses   Registry;   
    
  procedure   TForm1.Button1Click(Sender:   TObject);   
  Var     list,softList   :TStringList;   
            Reg   :TRegistry;   
            FPath,FKey,SubString:String;   
            i:   integer;   
  begin   
        FPath   :=   'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall';   
        FKey   :=   'DisplayName';   
        list   :=   TStringList.Create;   
        softList   :=   TStringList.Create;   
        Reg   :=   TRegistry.Create;   
    try   
        Reg.RootKey   :=   HKEY_LOCAL_MACHINE;   
        If   Reg.OpenKey(FPath,   False)   then   
            Reg.GetKeyNames(List);   
            List.Sort;   
            List.BeginUpdate;   
        Reg.CloseKey;   
        If   Reg.OpenKey(FPath,   False)   then   
              Edit1.Text   :=   List[0];   
            //Edit1.Text   :=   Reg.ReadString('DriverDesc');   
        Reg.CloseKey;   
        for   i:=0   to   List.Count-1   do   begin   
              FPath   :=   'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+List[i];   
              if   (Reg.OpenKey(FPath,False))   and   (Reg.ReadString(FKey)<>'')     then   
                  softList.Add(Reg.ReadString(FKey));   
              Reg.CloseKey;   
        end;//end   for   
    finally   
        Reg.Free;   //   用   Try..Finally   结构确保   REG   变量能够释放。   
    end;   
    softList.Sort;   
    ListBox1.Items:=softlist;   
  end;

相关阅读 >>

Delphi datasnap中间件如何控制长连接的客户端连接?

Delphi 如何使用程序标识符检查程序是否已安装

Delphi使用idhttp模拟提交页面方法总结

Delphi 2010 unicode

Delphi 三种方式读取txt文本文件

Delphi响应wmi事件(响应网线断开)

Delphi 获取计算机已运行时间

Delphi实现图像反色实例4种方法

相对完整的多线程idhttp文件下载代码

Delphi 能否把.txt文件的数据导入到access数据库中

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...