procedure TfMian.Button1Click(Sender: TObject);
var
MyList: TStringList;
MyRegistry: TRegistry;
i: Integer;
Str: string;
install: TextFile;
TempStr: String;
// Copy-paste to populate the table
s: WideString; // Read from the install
d: WideString; // Read from the NameProgramm in d
f: string; // Read from the Rasprost
g: string; // Read from the License
h: string; // Read from the Stoimost
j: string; // Read from the Zamena
k: integer; // to fill these
Result: integer; // Compare
for1: integer;
begin
Cursor:= crHourGlass;
bSearch.Visible:=False;
Button1.Visible:=False;
// Get the list of installed programs
MyRegistry:=TRegistry.Create;
MyList:=TStringList.Create;
AssignFile(install, UTF8ToSys('install.txt'));
ReWrite(install);
with MyRegistry do
begin
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall',
False)=True then GetKeyNames(MyList); // Get the key variable mylist
TempStr := MyList.Text; // Convert to string
Writeln(install, TempStr); // Write to file
CloseKey;
end;
CloseFile(install);
try
// Connect text files for further work with them
AssignFile(install, 'install.txt');
Reset(install);
AssignFile(NameProgramm, 'NameProgramm.txt');
Reset(NameProgramm);
AssignFile(Rasprost, 'Rasprost.txt');
Reset(Rasprost);
AssignFile(License, 'License.txt');
Reset(License);
AssignFile(Stoimost, 'Stoimost.txt');
Reset(Stoimost);
AssignFile(Zamena, 'Zamena.txt');
Reset(Zamena);
// Do until the end of the file:
while not Eof(install) do begin
Cursor:= crHourGlass;
Readln(install, s); // Read in with the next line
Readln(NameProgramm, d);
Readln(Rasprost, f); // Read in and the next row
Readln(License, g);
Readln(Stoimost, h);
Readln(Zamena, j);
Result:= WideCompareText( widestring(s), widestring(d) );
if Result=0 then begin
// Further it is necessary to record that found
StringGrid1.RowCount:= StringGrid1.RowCount + 1;
k:= StringGrid1.RowCount;
SetLength(d, (k * 15));
StringGrid1.Cells[0, StringGrid1.RowCount-1]:= UTF8ToSys(s);
StringGrid1.Cells[1, StringGrid1.RowCount-1]:= UTF8ToSys(f);
StringGrid1.Cells[2, StringGrid1.RowCount-1]:= UTF8ToSys(g);
StringGrid1.Cells[3, StringGrid1.RowCount-1]:= UTF8ToSys(h);
StringGrid1.Cells[4, StringGrid1.RowCount-1]:= UTF8ToSys(j);
end;
end;
finally
CloseFile(install);
CloseFile(NameProgramm);
CloseFile(Rasprost);
CloseFile(License);
CloseFile(Stoimost);
CloseFile(Zamena);
Cursor:= crDefault;
end; //try
end;