代码需要与D2007和D2009兼容。
我的回答:感谢所有回答的人,我选择了:
我的回答:感谢所有回答的人,我选择了:
function ComputerName : String;
var
buffer: array[0..255] of char;
size: dword;
begin
size := 256;
if GetComputerName(buffer, size) then
Result := buffer
else
Result := ''
end;
GetComputerName
返回一个Bool
,第二个参数不能接受数字字面值。 - Rob KennedyMax_ComputerName_Length
代替魔术数字。 - Rob Kennedy