Login:  Password:    
forgot my password
sign up!
Search: 

TRegIniFile: Windows Registry in Delphi

In this Quick Tips we will create a routine to log information in the Windows registry.

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

 





Add a comment!
[Fechar]

Este post é fechado - você precisa ter acesso ao post para incluir um comentário.


No comment was posted yet - be the first!



 
Help us to improve! Give us your feedback:
Give your note to the technical content
10 9 8 7 6 5 4 3 2 1
Give your note to the post's learning
10 9 8 7 6 5 4 3 2 1
Is this post helpful?
Yes No


Wesley Yamazack Batista
Graduated in System Analysis, in business development for over six years, where he worked in companies of various segments such as financial, commercial, parking, etc.. He is currently a third-party developer analyst Navy of Brazil, and to develop pa...


Go to author's Space


Post stats:
Favorited:
 0

Post actions:
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

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

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits








mrbool.com
contact us   |   publish your post   |   buy credits

Copyright 2012 - all rights reserved to www.web-03.net