- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Getting user name and company info from Windows.

Question:

How do I retrieve the user name and company information from Windows?

Answer:

This information is stored under the "HKEY\CURRENT USER" section
of the Windows registry. The task of retrieving this entry is greatly
simplified by using the TRegIniFile component.

Example:

uses Registry;

procedure TForm1.Button1Click(Sender: TObject);
var
  reg: TRegIniFile;
begin
  reg := TRegIniFile.create('SOFTWARE\MICROSOFT\MS SETUP (ACME)\');
  Memo1.Lines.Add(reg.ReadString('USER INFO',
                                 'DefName',
                                 'Frank Borland'));
  Memo1.Lines.Add(reg.ReadString('USER INFO',
                                 'DefCompany',
                                 'A Valued Borland Customer'));
  reg.free;
end;



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile