implementation
var
FileReg: TRegIniFile;
begin
FileReg := TRegIniFile.Create(xFile);
Try
FileReg.WriteString(xSection, xIdent, xValue);
Finally
FileReg.Free;
end;
end;
{Function to return the contents of a determined registry}
function ReadRegister(xFile, xSection, xIdent: String): String;
var
FileReg: TRegIniFile;
begin
FileReg := TRegIniFile.Create(xFile);
Try
Result := FileReg.ReadString(xSection, xIdent, '');
Finally
FileReg.Free;
end;
end;
end.
* 2 BitBtn (BtnSave, BtnRead).
See the image below:

{Implementing the OnClick event of BtnSave}
procedure TFrmPrincipal.BtnSaveClick(Sender: TObject);
begin
SaveRegister(EdtFile.Text, EdtSection.Text, EdtIdent.Text, EdtContent.Text);
EdtContent.Clear;
end;
{ Implementing the OnClick event of BtnRead }
procedure TFrmPrincipal.BtnReadClick(Sender: TObject);
begin
EdtContent.Text := ReadRegister (EdtFile.Text, EdtSection.Text, EdtIdent.Text );
end;
Where can we use this feature?
We can save the last user logged on, the last date of entry into the system, a serial register to hinder piracy of our software and more.
Until next Quick Tips!
Wesley Y
wyamazack@rwsolution.com.br

See the prices for this post in Mr.Bool Credits System below: