Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

EnumAllKeys [KOL]


KOLBOSS ©   (2008-07-31 14:47:00) 

Помогите перевести на КОЛ.

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;


Vladimir Kladov   (2009-12-07 21:56:00) [1]

You can write in English. Ili translitom v krajnem slutchae.


koal   (2009-12-07 20:17:00) [2]

////////////////////////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//////////////////////////


KOLBOSS   (2008-08-03 09:37:00) [3]

Thaddy
Спасибо!


Thaddy   (2008-08-01 16:50:00) [4]

Try this:
http://thaddy.co.uk/kolexregistry.zip


KOLBoss   (2008-07-31 17:26:00) [5]

Вот набросал, работает.
но что-то мне подсказывает что
это делать надо по другому как-то? или и так должно быть?

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;


KOLBoss   (2008-07-31 15:28:00) [6]

или как удалить ключь со всеми SubKeys?


Наверх

Титульная страница Поиск, карта сайта Написать письмо