Solved

How to read Strings (REG_SZ) from Registry?

Posted on 1998-06-25
4
994 Views
Last Modified: 2010-04-04
Hi...

I already found out, how to write a String or better spoken,
a pChar to the WinRegistry (win95). But how life is...I'm unable to read it back later... And if you are already there, how does that work with numeric/binary types ? Like I said, all I can do yet, is to create my own Keys and set REG_SZ - Values. It also seems, there are some Keywords, like "DefaultIcon", "ShellNew", etc. could u tell me what keyword does what job ?

Thanx, :)
0
Comment
Question by:omsec
[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
4 Comments
 
LVL 3

Expert Comment

by:vladika
ID: 1355693
Use class TRegistry and its metods.
For reading use OpenKey then ReadString
See in help full information about TRegistry

0
 
LVL 2

Author Comment

by:omsec
ID: 1355694
sorry, dude i expected some source for these points
0
 
LVL 4

Accepted Solution

by:
d003303 earned 70 total points
ID: 1355695
uses Registry;

procedure WriteToReg(Key, ValueName, Value : string);
var Registry : TRegistry;
begin
  Registry := TRegistry.Create;
  try
    Registry.RootKey := HKEY_CLASSES_ROOT; // for example
    Registry.OpenKey(Key, true);
    // you could also use WriteBinaryData, WriteBool, WriteCurrency, WriteDate, WriteDateTime, WriteFloat, WriteInteger, WriteTime
    Registry.WriteString(ValueName, Value);
  finally
    Registry.Free;
  end;
end;

function ReadFromReg(Key, ValueName : string): string;
var Registry : TRegistry;
begin
  Registry := TRegistry.Create;
  Result := '';
  try
    Registry.RootKey := HKEY_CLASSES_ROOT; // for example
    if Registry.OpenKey(Key, true) then
    // you could also use ReadBinaryData, ReadBool, ReadCurrency, ReadDate, ReadDateTime, ReadFloat, ReadInteger, ReadTime
     Result := Registry.ReadString(ValueName);
  finally
    Registry.Free;
  end;
end;

Slash/d003303
0
 
LVL 4

Expert Comment

by:d003303
ID: 1355696
For the meaning of the keywords you mentioned, take a look at the Microsoft Knowledge Base at
http://www.microsoft.com/win32dev/uiguide/uigui255.htm
for a description of the W95 registry.

Slash/d003303
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
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 this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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