Changeset 20


Ignore:
Timestamp:
May 14, 2010, 7:00:10 AM (14 years ago)
Author:
george
Message:
  • Přidáno: Funkce pro zjištění jména přihlášeného uživatele.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r17 r20  
    1616function BCDToInt(Value: Byte): Byte;
    1717function CompareByteArray(Data1, Data2: TArrayOfByte): Boolean;
     18function GetUserName: string;
    1819
    1920implementation
     
    112113end;
    113114
     115function GetUserName: string;
     116const
     117  MAX_USERNAME_LENGTH = 256;
     118var
     119  L: LongWord;
     120begin
     121  L := MAX_USERNAME_LENGTH + 2;
     122  SetLength(Result, L);
     123  if Windows.GetUserName(PChar(Result), L) and (L > 0) then
     124    SetLength(Result, StrLen(PChar(Result))) else
     125    Result := '';
     126end;
     127
    114128end.
Note: See TracChangeset for help on using the changeset viewer.