Solved

How to read Strings (REG_SZ) from Registry?

Posted on 1998-06-25
4
932 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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:vladika
Comment Utility
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
Comment Utility
sorry, dude i expected some source for these points
0
 
LVL 4

Accepted Solution

by:
d003303 earned 70 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

14 Experts available now in Live!

Get 1:1 Help Now