http://www.cnblogs.com/safezone/articles/1260836.html
1 function GetComputerNameX: string;
2 var
3 i: Cardinal;
4 cBuff: PChar;
5 begin
6 GetMem(cBuff, 128);
7 i := 128;
8 GetComputerName(cBuff, i);
9 Result := StrPas(cBuff);
10 end;
2 var
3 i: Cardinal;
4 cBuff: PChar;
5 begin
6 GetMem(cBuff, 128);
7 i := 128;
8 GetComputerName(cBuff, i);
9 Result := StrPas(cBuff);
10 end;