🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Registry in WinXP

#7633
From: Detlef
Date: Tue, 18 Jan 2005 10:02
56 lines
2526 bytes
Hi Grety,
did you have the permission to add keys in the registry ? Please try this
with regedit.
The following code is working:
//-----------------------------------------------------------------------
try
{
TRegistry *Reg = new TRegistry;
String Key = "\\Software\\YourKey\\" ;

Reg->RootKey = HKEY_LOCAL_MACHINE;

//----------------------------------------------------------------------
// read the position / color of the form
if (!Reg->OpenKey( Key, true))
 {
   delete Reg;
   return -1;
   }
Reg->WriteInteger( "TrayCounter", iGlobalTrays);
Reg->CloseKey();
catch( Exception &exception)
 {
   msg = "Error at registry: " + exception.Message;
   printf( "%s\n", msg.c_str());
   return -3;
   }
//-----------------------------------------------------------------------
Best regards
Detlef
www.seatec-gmbh.com

"Grety" <valid@emailaddress.com> schrieb im Newsbeitrag
news:41ecdb87@newsgroups.borland.com...
> Hi
> Can I have some very easy and simple code about Regisrty Already work in
> WinXP?
> The code below is working in Win98 but  XP !!!!
>
>
> //Not Tested
> #include "registry.hpp"
> TRigistry *MyReg=new TRegistry();
> MyReg->RootKey=HKey_Local_Machine;
> MyReg->OpenKey("Software\\TheKey");
> MyReg->WriteString("MyStr",true);
> MyReg->CloseKey();
> delete MyReg;
>
> The Codes are working in Win98 but its not responding / functioning in
Win98
> or NT systems
> there is a .default :-\
> please guide me thx
>
>
Technical Details
Message-ID: <41ecde62@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41ecdb87@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,26d4cbfcdfdcb29b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Detlef" <detlef.stute@seatec-gmbh.com>
From: "Detlef" <detlef.stute@seatec-gmbh.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41ecdb87@newsgroups.borland.com>
Subject: Re: Registry in WinXP
Date: Tue, 18 Jan 2005 11:02:28 +0100
Lines: 58
Organization: SEATEC GmbH
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 84.132.135.112
Message-ID: <41ecde62@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106042466 84.132.135.112 (18 Jan 2005 02:01:06 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail