Solved

Deleting registries

Posted on 2004-09-08
2
191 Views
Last Modified: 2010-04-05
Hello,

Anyone can show me a code how to delete this registry :

   \HKEY_CURRENT_USER\Software\MyCompany\MyApplication\

Below ...\MyApplications\ there are some more keys and "folders" .

So after the deletion, the registry should be like this :

   \HKEY_CURRENT_USER\Software\MyCompany\

Thanks,
0
Comment
Question by:dudup
  • 2
2 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12007268
use Registry

procedure TForm1.Button1Click(Sender: TObject);
var
  Reg: TRegistry;
begin
  Reg:=TRegistry.Create;
  try
      Reg.RootKey:=HKEY_CURRENT_USER; // Section to look for within the registry
      if not Reg.OpenKey('Software\MyCompany\MyApplication',False) then
        ShowMessage('Error opening key')
      else
        Reg.DeleteKey('Software\MyCompany\MyApplication\');
  finally
    Reg.Free;
  end;
end;
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 160 total points
ID: 12007312
mmm...

the correct syntax is the following

Reg:=TRegistry.Create;
  try
      Reg.RootKey:=HKEY_CURRENT_USER;
      if not Reg.OpenKey('\Software\MyCompany\MyApplication',False) then
        ShowMessage('Error opening key')
      else
        Reg.DeleteKey('\Software\MyCompany\MyApplication');
  finally
    Reg.Free;
  end;
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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