The best way to access to the registry is using TRegistry class.
TRegistry *Path;
Registry has "Keys" and "Values". Keys are "like" directories and Values are "like" files.
With TRegistry class you can access to one Key setting the "RootKey" and then Open
a key below it.
Path=new TRegistry;
Path->RootKey=HKEY_LOCAL_MACHINE; // Or other Root key
Path->OpenKey("\\Software\\MySoftware",true); // Open or create
Then, you can access to single "Values" by name. They can be BinaryData, Bool, Currency, Date, DateTime, Float, String, Integer and Time.
// To assure you have a value :
if (!Path->ValueExists("MyValue")){
Path->WriteInteger("MyValue",_DEFAUL_VALUE);
}
// To Read :
int Value;
Value=Path->ReadInteger("MyKey");
// or
String Value;
Value=Path->ReadString("MyKey");
...
// Write :
int Value;
Path->WriteInteger("MyKey",Value);
// or
String Value;
Path->WriteInteger("MyKey",Value);
...
delete Path;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.