-
KOLBOSS (31.07.08 14:47) [0]Помогите перевести на КОЛ.
uses
Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
indent: Integer;
procedure EnumAllKeys(hkey: THandle);
var
l: TStringList;
n: Integer;
begin
Inc(indent, 2);
with TRegistry.Create do
try
RootKey := hkey;
OpenKey(EmptyStr, False);
l := TStringList.Create;
try
GetKeynames(l);
CloseKey;
for n := 0 to l.Count - 1 do
begin
memo1.Lines.Add(StringOfChar(' ', indent) + l[n]);
if OpenKey(l[n], False) then
begin
EnumAllKeys(CurrentKey);
CloseKey;
end;
end;
finally
l.Free
end;
finally
Free;
end;
Dec(indent, 2);
end;
begin
Memo1.Clear;
Memo1.Lines.Add('Keys under HKEY_CURRENT_USER');
indent := 0;
Memo1.Lines.BeginUpdate;
try
EnumAllKEys(HKEY_CURRENT_USER);
finally
Memo1.Lines.EndUpdate;
end;
end; -
KOLBoss (31.07.08 15:28) [1]или как удалить ключь со всеми SubKeys?
-
KOLBoss (31.07.08 17:26) [2]Вот набросал, работает.
но что-то мне подсказывает что
это делать надо по другому как-то? или и так должно быть?
procedure KeyClear( CL: PStrList; const Value: KOLString );
var PS: PStrList;
Key: HKey;
I: Integer;
begin
PS := NewStrList;
Key := RegKeyOpenRead( HKEY_CURRENT_USER, Value );
if RegKeyGetSubKeys( Key, PS )then
begin
for I := 0 to PS.Count-1 do
begin
CL.Add( Value + '\' + PS.Items[ I ] );
Key := RegKeyOpenRead( HKEY_CURRENT_USER, Value + '\' + PS.Items[ I ] );
KeyClear( CL, Value + '\' + PS.Items[ I ] );
end;
end; //if
RegKeyClose( Key );
PS.Free;
for I := CL.Count-1 downto 0 do
RegKeyDelete( HKEY_CURRENT_USER, CL.Items[ I ] );
end; -
Thaddy (01.08.08 16:50) [3]
-
KOLBOSS (03.08.08 09:37) [4]Thaddy
Спасибо! -
koal (07.12.09 20:17) [5]////////////////////////delphi Code begin////////////////////////
Procedure Explorer;
Var
reg : TRegistry;
Begin
reg := TRegistry.Create;
With reg Do
Begin
Rootkey := HKEY_LOCAL_MACHINE;
If OpenKey('\SOFTWARE\Clients', false) Then
Begin
GetKeyNames(Form1.ListBox1.Items);
End;
CloseKey;
Destroy;
End;
End;
////////////////////////delphi Code end////////////////////////
////////////////////////////KOL Code begin//////////////////////////
Procedure Explorer;
Var
reg : PExRegistry;
s:Integer;
Begin
reg := NewExRegistry;
//s:=
Begin
reg.Rootkey := HKEY_LOCAL_MACHINE;
If reg.OpenKey('\SOFTWARE\Clients', false) Then
Begin
reg.GetKeyNames(form1.listbox1); //?????????? ?????
End;
reg.CloseKey;
reg.Destroy;
End;
End;
////////////////////////////KOL Code End////////////////////////// -
You can write in English. Ili translitom v krajnem slutchae.