Solved

How to write and read register ?

Posted on 1998-01-19
2
164 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now