Solved

How to write and read register ?

Posted on 1998-01-19
2
166 Views
Last Modified: 2010-05-18
I'm making a program that needs to write and read some information to the register.

The information I need to write is the directory were the program is stored and what the name of the database is.

This information must also been read by my program.

How can I do this ?
0
Comment
Question by:CyberChild
2 Comments
 
LVL 2

Accepted Solution

by:
mvz121697 earned 150 total points
ID: 1357027
To read from the registry:
(reads registry value of yyyy in Key xxxx)

    Var
      tReg : TRegistry;
      cDir : String;

    Begin
      tReg := TRegistry.Create;
      With tReg Do
        Begin
          RootKey := HKEY_LOCAL_MACHINE;
         If OpenKey('software\microsoft\windows\currentversion\app\paths\xxxxxx',false)
            Then
              cDir := ReadString('yyyy')
            Else
              cDir:='?????';
          Free
        End;
       End;

To write to registry, use writestring, writeinteger, ....
example:

var
  Registry: TRegistry;
begin
  Registry:=TRegistry.Create;
  with Registry do begin
   RootKey:=HKEY_CURRENT_USER;
  OpenKey('Software\...\..',TRUE);
   WriteString('xxxx','yyyyy');
   CloseKey;
  end;
  Registry.Free;

Greetings,
MvZ
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1357028
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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