function TMainFrm.GetLocalComputer: string;
var
ComputerName: Pchar;
Size: DWord;
begin
GetMem(ComputerName, 255);
Size := 255;
if GetComputerName(ComputerName, Size) then
begin
Result := ComputerName;
FreeMem(ComputerName);
Exit;
end;
FreeMem(ComputerName);
end;