给你一个函数!<br>Function GetComputerName:string; //计算机名字<br>var Name1 : string;<br> Computer : PChar; //for 计算机名字<br> CSize : DWORD; //for 计算机名字<br>begin<br>Computer:=#0; CSize:=MAX_COMPUTERNAME_LENGTH + 1; //must CSize>1或指定一个足够的数值如200<br>try<br> GetMem( Computer,CSize );<br> if Windows.GetComputerName(Computer,CSize) then Name1:= Computer;<br> finally<br> FreeMem(Computer);<br> end;<br>Result:=Name1;<br>end;