Get a computer name

Posted in System info

You can use GetComputerName procedure. For example:

procedure TForm1.Button1Click(Sender: TObject);
var
  CompName: array[0..256] of Char;
  i: DWord;
begin
  i:=256;
  GetComputerName(CompName, i);
  Label1.Caption:=StrPas(CompName);
end;