Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

Viewing Registry

hello,
how to do the following

List all the keys in HKEY_CURRENT_USER in ListBox1
and list all the values in HKEY_CURRENT_USER in ListBox2

not the sub-keys
for example I want HKEY_CURRENT_USER\Key1
Not HKEY_CURRENT_USER\Key1\SubKey1

how to do that?

Ive done this:
reg:=tregistry.Create;
Reg.RootKey:= hkey_local_machine;
For x := 0 to ????? do
ListBox1.AddItem Reg.?????
0
peritoX
Asked:
peritoX
  • 3
  • 2
1 Solution
 
DragonSlayerCommented:
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.GetKeyNames(ListBox1.Items);
Reg.GetValueNames(ListBox2.Items);



DragonSlayer.
0
 
peritoXAuthor Commented:
procedure TForm1.Button1Click(Sender: TObject);
var Reg : tregistry;
begin
reg:=tregistry.Create ;
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.GetKeyNames(ListBox1.Items);
Reg.GetValueNames(ListBox2.Items);
end;

nothing is happening at all
why?
0
 
DragonSlayerCommented:
 with TRegistry.Create do
  try
    RootKey := HKEY_LOCAL_MACHINE;
    OpenKey(EmptyStr, False);
    GetKeyNames(ListBox1.Items);
    GetValueNames(ListBox2.Items);
    CloseKey;
  finally
    Free;
  end;
0
 
peritoXAuthor Commented:
Thank You Alot
0
 
DragonSlayerCommented:
You are welcome. Glad to be of help! :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now