Главная страница | назад





Article #15633: Getting user name and company info from Windows.

 Question and Answer Database

FAQ633D.txt   Getting user name and company info from Windows.
Category   :Windows API
Platform    :All
Product    :All 32 bit  

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;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99