function GetComputerName: string;
var
buffer: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
Size: Cardinal;
begin
Size := MAX_COMPUTERNAME_LENGTH + 1;
Windows.GetComputerName(@buffer, Size);
Result := StrPas(buffer);
end;
example usage :
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := GetComputerName;
end;
0 comments:
Post a Comment