Category: System Information
Title: Set/retrieve the Computer Name
Date added: 15.03.2006
Hits: 3075
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;
function SetComputerName(AComputerName: string): Boolean;
var
ComputerName:
array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
Size: Cardinal;
begin
StrPCopy(ComputerName, AComputerName);
Result := Windows.SetComputerName(ComputerName);
end;