var
ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char;
// holds the name
Size: DWORD;
// holds the size
begin
{initialize the computer name size variable}
Size := MAX_COMPUTERNAME_LENGTH+1;
{retrieve the computer name}
if GetComputerName(ComputerName, Size) then
Edit1.Text := StrPas(Computername)
else
Showmessage('Computer Name Not Found');
end