it is in Delphi help->windows sdk
procedure TForm1.Button1Click(Sender: Tobject);
var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
Size: Integer;
begin
Size := MAX_COMPUTERNAME_LENGTH+1;
if GetComputerName(ComputerName, Size) then
Edit1.Text := StrPas(Computername)
else
Showmessage('Computer Name Not Found');
end;