function GetPCName: string; var LocalMachine: PChar; Len: DWord; begin Len := MAX_COMPUTERNAME_LENGTH + 1; // 取得本机电脑名称 GetMem(LocalMachine, Len); if GetComputerName(LocalMachine, Len) then Result := LocalMachine else Result := 'UnKnow'; FreeMem(LocalMachine, Len); end;