Article View: comp.lang.pascal.delphi.misc
Article #166Re: get data from Registry
From: Gentleman Jersey Dan
Date: Sun, 06 Jul 1997 00:00
Date: Sun, 06 Jul 1997 00:00
36 lines
2119 bytes
2119 bytes
I prefer this to the try...except...finally stuff:
IF Reg.ValueExists('Preview Reports') THEN
PreviewReports.Text := Reg.ReadString('Preview Reports');
Obviously, you can still an ELSE in there for when the value doesn't exist.
And I prefer doing it with TRegistry, rather than TRegIniFile (which is
good for people who can't decide if they want to use the Registry or Ini
files....)
Chris Cowherd <NO_SPAM_bakedon@goodnet.com> wrote in article
<01bc8a4a$affdf380$c6fdcccf@dwarfs>...
> procedure T__Main.FormCreate(Sender: TObject);
> var
> reg : TRegistry;
> begin
> reg := TRegistry.Create;
> try
> reg.OpenKey('\Software\Acanthus\Dealer\General\', true);
> try
> PreviewReports.Text := reg.ReadString('Preview Reports');
> except
> // This is here in case this is the registry entry is not there. I
don't
> want an error generated.
> end;
> finally
> reg.Free;
> end;
> end;
> Shay Toder <shayt@inter.net.il>
> > how do I get a data from the registry ?
> > I've got the RegOpenKey to open the key, but fhe function brings me
> > handle to the key, and i want to get the string i put in a key.
Technical Details
Message-ID:
<01bc8a92$bcc64520$45d22393@wojcikd>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<33BF8946.14BC8A9F@inter.net.il> <01bc8a4a$affdf380$c6fdcccf@dwarfs>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1091e5,eb456324663bca5d X-Google-Attributes: gid1091e5,public X-Google-Thread: fd817,eb456324663bca5d X-Google-Attributes: gidfd817,public X-Google-Thread: f973d,eb456324663bca5d X-Google-Attributes: gidf973d,public X-Google-Thread: 10baee,eb456324663bca5d X-Google-Attributes: gid10baee,public X-Google-Thread: 10545b,eb456324663bca5d X-Google-Attributes: gid10545b,public From: "Gentleman Jersey Dan" <wojcik@satcom.kasierslautern.army.mil> Subject: Re: get data from Registry Date: 1997/07/06 Message-ID: <01bc8a92$bcc64520$45d22393@wojcikd> X-Deja-AN: 255077018 References: <33BF8946.14BC8A9F@inter.net.il> <01bc8a4a$affdf380$c6fdcccf@dwarfs> Organization: Brute Force Programming Newsgroups: comp.lang.pascal.delphi.misc,alt.lang.delphi,alt.comp.lang.borland-delphi,borland.public.delphi.ide,borland.public.delphi.winapi