Well, the compiler doesn't report any error (as the code is all right), however when I'm trying to read this string the program gives a message: "Invalid registry data type: ButtonFace". I've tried to see why this error occurs, and I tried code like that:
Reg:=TRegistry.Create;
Reg.RootKey:=HKEY_CURRENT_USER;
Reg.OpenKey('Control Panel\Colors',True);
if Reg.GetDataType('ButtonFace')=RdUnknown then ShowMessage('Unknown');
if Reg.GetDataType('ButtonFace')=RdString then ShowMessage('String');
if Reg.GetDataType('ButtonFace')=RdExpandString then ShowMessage('ExpandString');
if Reg.GetDataType('ButtonFace')=RdInteger then ShowMessage('Integer');
if Reg.GetDataType('ButtonFace')=RdBinary then ShowMessage('Binary');
ShowMessage(IntToStr(Reg.GetDataSize('ButtonFace')));
ShowMessage(Reg.ReadString('ButtonFace')+';'+IntToStr(Length(Reg.ReadString('ButtonFace'))));
Reg.Free;
And it shows rdUnknown with Length=-1. Why? On Delphi the same code shows rdString with Length 11...