Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hi there Delphers - Q on OpenRegKeyEx

Posted on 1999-01-24
2
Medium Priority
?
176 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 300 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

596 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