Solved

How to write and read register ?

Posted on 1998-01-19
2
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

696 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