Article View: comp.lang.pascal.delphi.misc
Article #396Re: How to create a Key in REGISTRY ???
From: J.A. Korten
Date: Sat, 22 May 1999 00:00
Date: Sat, 22 May 1999 00:00
49 lines
2119 bytes
2119 bytes
Chow Hoi Ka, Eric heeft geschreven in bericht
<3746EEDC.1A12207A@sftw.umac.mo>...
>Hello,
>
>1) How to get the Windows Path ???
Question:How can I determine where the Windows directory is?Answer:
You can make a call to the Windows API functionGetWindowsDirectory().
If you want the system directory, simply call the Windows API function
GetSystemDirectory().Example:{$IFNDEF WIN32} const MAX_PATH = 144;{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);var
a : Array[0..MAX_PATH] of char;begin GetWindowsDirectory(a, sizeof(a));
ShowMessage(StrPas(a)); GetSystemDirectory(a, sizeof(a));
ShowMessage(StrPas(a));end;
>
>2) How can I create a VALUE in REGISTRY ?
Create a registry variable:
use registry;
var myreg : Tregistry
myreg := tregistry.create;
myreg.rootkey := HKEY_CURRENT_USER;
myreg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Run', true);
myreg.Writestring('testregistry');
myreg.WriteInteger('12345');
myreg.closekey;
muyreg.free;
Greetings Johan Korten
>
>Such as,
>
>I want to put this value into
>\HKKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run :
>
>String ="TestRegistry"
>Value=12345
>
>
>Best regards,
>Eric
>
>
Technical Details
Message-ID:
<7i6sct$1an$1@reader.wxs.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3746EEDC.1A12207A@sftw.umac.mo>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd817,c46fe20f3e9c5522,start X-Google-Attributes: gidfd817,public X-Google-Thread: 10baee,c46fe20f3e9c5522,start X-Google-Attributes: gid10baee,public X-Google-Thread: 1043cf,c46fe20f3e9c5522,start X-Google-Attributes: gid1043cf,public From: "J.A. Korten" <jksoft@capitolonline.nl> Subject: Re: How to create a Key in REGISTRY ??? Date: 1999/05/22 Message-ID: <7i6sct$1an$1@reader.wxs.nl> X-Deja-AN: 480947186 References: <3746EEDC.1A12207A@sftw.umac.mo> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: abuse@wxs.nl X-Trace: reader.wxs.nl 927397085 1367 195.121.140.171 (22 May 1999 18:18:05 GMT) Organization: World Access / Planet Internet NNTP-Posting-Date: 22 May 1999 18:18:05 GMT Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.lang.borland-delphi,borland.public.delphi.objectpascal