Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TRegistry.ReadString

Status
Not open for further replies.

Sisto

Programmer
May 29, 2001
25
US

I am trying to read the (Default) value of the key .lay and the following does not work. Any suggestions?

I am trying the following:
Var RegistryDB : TRegistry;
aStringValue : String;
...
RegistryDB.RootKey := HKEY_CLASSES_ROOT; {working}
RegistryDB.OpenKey('.lay\'); {working}
aStringValue := RegistryDB.ReadString('(Default)'); {not working}

Thanks for any input.
 
You shouldn't need any slashes - does the key name actually have a \ at the end of it? OpenKey should require a second paramater (at least in D5!) which is whether or not it can create the key if it does not exist. If that parameter is true maybe you've just created a new key instead of opening the one you wanted.

Hope that helps...
TealWren
 
Thankyou TealWren.

I figured it out. The second parameter was left out due to a typo. The parameter that seems to work is as follows:

RegistryDB.OpenKey('.lay/',false);
aStringValue := RegistryDB.ReadString('');

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top