Solved

Deleting registries

Posted on 2004-09-08
2
187 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now