Solved

Deleting registries

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

Independent Software Vendors: 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

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