function GetlocalcomputerName:string;/**/////获取计算机名称 var lpName:pchar; lpSize:DWord; begin lpSize:=255; getmem(lpName,255); GetComputerName(lpName,lpSize); Result:=trim(lpName); end; Function GetUserFromWindows: string;//获取登录计算机用户的名称 Var UserName : string; UserNameLen : Dword; Begin UserNameLen :=255; SetLength(userName, UserNameLen) ; If GetUserName(PChar(UserName), UserNameLen) Then Result := Copy(UserName,1,UserNameLen -1) Else Result :='Unknown'; End; end.