不知道是不是这个:<br><br>function GUserName: String;<br>var<br> pcUser : PChar;<br> dwUSize : DWORD;<br>begin<br> dwUSize := 21;<br> result:='';<br> GetMem( pcUser, dwUSize );<br> try<br> if Windows.GetUserName( pcUser, dwUSize ) then<br> Result := pcUser<br> finally<br> FreeMem( pcUser );<br> end;<br>end;