Solved

Hi there Delphers - Q on OpenRegKeyEx

Posted on 1999-01-24
2
156 Views
Last Modified: 2010-04-06
I am writing a program in which needs to open a key in the registry - I can't make head nor tail of the Delphi help file though! It's a long key with many subdir's!

i.e HKEY_CLASSES_ROOT\CLSID\{very-long-name-here!}\etc.

I then wish to delete the values in that key

Can anyone help me?

Cheers

Jim
0
Comment
Question by:Rudolf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
heathprovost earned 100 total points
ID: 1363095
How about this....





procedure DeleteKeyValues(TheRootKey: HKEY; KeyName: String);
var
  Reg: TRegistry;
  Values: TStringList;
  I: integer;
begin
  Reg := TRegistry.Create;
  Values := TStringList.Create;
  try
    With Reg do
    begin
      RootKey := TheRootKey;
      OpenKey(KeyName, False);
      GetValueNames(Values);
      for I := 0 to Values.Count - 1 do
        DeleteValue(Values[I]);
      CloseKey;
    end;
  finally
    Values.Free;
    Reg.Free;
  end;
end;




You would call it in your case like this:

DeleteKeyValues(HKEY_CLASSES_ROOT, 'CLSID\{very-long-name-here!}\etc.')


Hope this helps


Heath
0
 

Author Comment

by:Rudolf
ID: 1363096
Cheers Heath - I will try it out when I get home but it looks good! Hope I graded you ok - difficult to grade you when I can't check it out!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question