Here is a simple Delphi function that returns the name of the computer. For additional Delphi code for the Windows operating system, see Useful Delphi Code for the Windows Operating System.
![]() |
![]() |
![]() |
function ComputerName: String;
var
Size: DWORD;
Name: Array[0..MAX_COMPUTERNAME_LENGTH] of char;
begin
ComputerName := '';
Size := 0;
Size := MAX_COMPUTERNAME_LENGTH + 1;
GetComputerName(Name, Size);
ComputerName := String(Name);
end;