Hello, thank you all very much for your help repeatedly!
Tell me please. At the moment, I get a list of the registry keys in a variable of type names tstringlist method GetKeyNames (MyList).
I need to get to MyList list of program names, ie, the parameters of these key "DisplayName". I found even GetDataInfo method ( 'DisplayName', MyDataInfo).
But I can not figure out how to make it work.
Here is the code without GetDataInfo
MyRegistry:=TRegistry.Create;
MyList:=TStringList.Create;
with MyRegistry do
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall',
False)=True then GetKeyNames(MyList);
CloseKey;
end;
Please tell me how to convert code to variable values contained Mylist DisplayName parameters.
Thanks in advance!
On the Internet, I found here such code, but alter it so that it worked, I did not succeed.
procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TStringList;
MyRegistry: TRegistry;
i: Integer;
Str: string;
begin
MyRegistry:=TRegistry.Create;
MyList:=TStringList.Create;
with MyRegistry do
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall',
False)=True then GetKeyNames(MyList);
CloseKey;
for i:=0 to MyList.Count-1 do
begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+
MyList[i], False);
Str:=ReadString('DisplayName');
if Str<>'' then
Memo1.Lines.Add(ReadString('DisplayName'));
CloseKey;
end;
end;
end;