Changeset 123 for Common/UCommon.pas


Ignore:
Timestamp:
Jan 5, 2011, 4:18:16 PM (14 years ago)
Author:
george
Message:
  • Added: Package TEditExtensions which will contains components derived from TEdit with specific edit constrains.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/UCommon.pas

    r31 r123  
    44
    55uses
    6   Windows, SysUtils, ShFolder, ShellAPI;
     6  Windows, Classes, SysUtils, SpecializedList; //, ShFolder, ShellAPI;
    77
    88type
     
    1010  TArrayOfString = array of string;
    1111
    12 function DelTree(DirName : string): Boolean;
     12  TUserNameFormat = (
     13    unfNameUnknown = 0, // Unknown name type.
     14    unfNameFullyQualifiedDN = 1,  // Fully qualified distinguished name
     15    unfNameSamCompatible = 2, // Windows NT® 4.0 account name
     16    unfNameDisplay = 3,  // A "friendly" display name
     17    unfNameUniqueId = 6, // GUID string that the IIDFromString function returns
     18    unfNameCanonical = 7,  // Complete canonical name
     19    unfNameUserPrincipal = 8, // User principal name
     20    unfNameCanonicalEx = 9,
     21    unfNameServicePrincipal = 10,  // Generalized service principal name
     22    unfDNSDomainName = 11);
     23
     24
    1325function IntToBin(Data: Cardinal; Count: Byte): string;
    1426function TryHexToInt(Data: string; var Value: Integer): Boolean;
    1527function TryBinToInt(Data: string; var Value: Integer): Boolean;
    16 function GetSpecialFolderPath(Folder: Integer): string;
     28//function DelTree(DirName : string): Boolean;
     29//function GetSpecialFolderPath(Folder: Integer): string;
    1730function BCDToInt(Value: Byte): Byte;
    1831function CompareByteArray(Data1, Data2: TArrayOfByte): Boolean;
    1932function GetUserName: string;
     33function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    2034function SplitString(var Text: string; Count: Word): string;
    2135function GetBit(Variable: QWord; Index: Byte): Boolean;
     
    2741implementation
    2842
    29 function DelTree(DirName : string): Boolean;
     43(*function DelTree(DirName : string): Boolean;
    3044var
    3145  SHFileOpStruct : TSHFileOpStruct;
     
    4963     Result := False;
    5064  end;
    51 end;
     65end;*)
    5266
    5367function BCDToInt(Value: Byte): Byte;
     
    5670end;
    5771
    58 function GetSpecialFolderPath(Folder: Integer): string;
     72(*function GetSpecialFolderPath(Folder: Integer): string;
    5973const
    6074  SHGFP_TYPE_CURRENT = 0;
     
    6781  else
    6882    Result := '';
    69 end;
     83end;*)
    7084
    7185function IntToBin(Data: Cardinal; Count: Byte): string;
     
    158172end;
    159173
     174procedure GetUserNameEx(NameFormat: DWORD;
     175  lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
     176  external 'secur32.dll' Name 'GetUserNameExA';
     177
     178
     179function LoggedOnUserNameEx(Format: TUserNameFormat): string;
     180var
     181  UserName: array[0..250] of Char;
     182  Size: DWORD;
     183begin
     184  Size := 250;
     185  GetUserNameEx(Integer(Format), @UserName, @Size);
     186  Result := UTF8Encode(UserName);
     187end;
     188
    160189function SplitString(var Text: string; Count: Word): string;
    161190begin
Note: See TracChangeset for help on using the changeset viewer.