Как получить/установить имя компьютера? |
|
Написал Ярослав Гасов
|
20.10.2009 |
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;
|