?
Solved

Hi there Delphers - Q on OpenRegKeyEx

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

801 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