🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16651

Re: Trying DeleteKey in the registry

#16651
From: Chris
Date: Sat, 03 May 2003 11:29
40 lines
2140 bytes
"Fernando Alvarez" <ferjat@lycos.es> wrote in message
news:3eb39873@newsgroups.borland.com...
>if(!registry->DeleteKey("\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Ru
n
\\Hello"))

Hi, I use the following as a function ;


bool DelRegKey(String KeyToOpen, String  KeyToDelete,void * RootKeyToOpen =
HKEY_CLASSES_ROOT);


bool DelRegKey(String  KeyToOpen, String KeyToDelete,void* RootKeyToOpen)
{
bool RetVal = false;
TRegistry *thisreg = new TRegistry;
try{
thisreg->RootKey = RootKeyToOpen;  //default if not supplied is
HKEY_CLASSES_ROOT

if (thisreg->OpenKey(KeyToOpen,false))
    {thisreg->DeleteKey(KeyToDelete);
     RetVal = true;}
else
    RetVal = false;
}
__finally
{
delete thisreg;
return RetVal;}
}


and then call it like this:
DelRegKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run","Hello");

--- I have not tested this but it really ought to work

Chris
Technical Details
Message-ID: <3eb3a809$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3eb2faf3$1@newsgroups.borland.com> <3eb2fbdb$1@newsgroups.borland.com> <3eb30123@newsgroups.borland.com> <3eb302cb$1@newsgroups.borland.com> <3eb30488$1@newsgroups.borland.com> <3eb30813$1@newsgroups.borland.com> <3eb39873@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,3359b20f1ef9dc9
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-03 04:39:59 PST
From: "Chris" <chris@chrischfmouseyREMOVE.karoo.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eb2faf3$1@newsgroups.borland.com> <3eb2fbdb$1@newsgroups.borland.com> <3eb30123@newsgroups.borland.com> <3eb302cb$1@newsgroups.borland.com> <3eb30488$1@newsgroups.borland.com> <3eb30813$1@newsgroups.borland.com> <3eb39873@newsgroups.borland.com>
Subject: Re: Trying DeleteKey in the registry
Date: Sat, 3 May 2003 12:29:12 +0100
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.249.178.39
Message-ID: <3eb3a809$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051961353 213.249.178.39 (3 May 2003 04:29:13 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail