- uses Classes, Registry;
-
- procedure GetKBid(KBList:TStrings; Simplified:boolean);
- function IDK(Chain:string):boolean;
- var idx : integer;
- begin
- Result:=true;
- for idx:=1 to Length(Chain) do
- Result:=Result and (Chain[idx] in ['0'..'9']);
- end;
- var i : integer;
- begin
- KBList.Clear;
- with TRegistry.Create do
- try
- RootKey:=HKEY_LOCAL_MACHINE;
- if OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall\',false) then
- begin
- GetKeyNames(KBList);
- for i:=KBList.Count-1 downto 0 do
- if ((UpperCase(Copy(KBList[i],1,2))<>'KB') or (not IDK(Copy(KBList[i],3,Length(KBList[i]))))) then
- KBList.Delete(i);
- CloseKey;
- end;
- if Simplified then
- for i:=0 to KBList.Count-1 do
- KBList[i]:=Copy(KBList[i],3,Length(KBList[i]));
- finally
- Free;
- end;
- end;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- GetKBid(ListBox1.Items,true);
- ListBox1.Items.Sort;
- end;
uses Classes, Registry;
procedure GetKBid(KBList:TStrings; Simplified:boolean);
function IDK(Chain:string):boolean;
var idx : integer;
begin
Result:=true;
for idx:=1 to Length(Chain) do
Result:=Result and (Chain[idx] in ['0'..'9']);
end;
var i : integer;
begin
KBList.Clear;
with TRegistry.Create do
try
RootKey:=HKEY_LOCAL_MACHINE;
if OpenKey('Software\Microsoft\Windows\CurrentVersion\Uninstall\',false) then
begin
GetKeyNames(KBList);
for i:=KBList.Count-1 downto 0 do
if ((UpperCase(Copy(KBList[i],1,2))<>'KB') or (not IDK(Copy(KBList[i],3,Length(KBList[i]))))) then
KBList.Delete(i);
CloseKey;
end;
if Simplified then
for i:=0 to KBList.Count-1 do
KBList[i]:=Copy(KBList[i],3,Length(KBList[i]));
finally
Free;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
GetKBid(ListBox1.Items,true);
ListBox1.Items.Sort;
end;