本文整理自网络,侵删。
下面程序是读出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实现win10下Delphi 10.3.1 inline hook 调试器法获取寄存器并修改
Delphi waitforsingleobject 响应窗体
Delphi xe ttask.waitforall/waitforany 一不小心会造成内存泄露
Delphi tdragimage v0.1 Delphi 图片拖拽组件 带有加速度 碰撞效果
Delphi idhttpserver接收http get请求解码问题
Delphi 导出excel报错:ole error 800a03ec
更多相关阅读请进入《Delphi》频道 >>