Solved

How to write and read register ?

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

10 Experts available now in Live!

Get 1:1 Help Now