Changeset 252


Ignore:
Timestamp:
Jun 16, 2011, 11:39:42 AM (13 years ago)
Author:
george
Message:
  • Fixed: Compilation on Linux.
Location:
Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Common/StopWatch.pas

    r118 r252  
    44interface
    55
    6 uses Windows, SysUtils, DateUtils;
     6uses
     7  {$IFDEF Windows}Windows,{$ENDIF}
     8  SysUtils, DateUtils;
    79
    8 type
     10type
     11  TLargeInteger = Int64;
     12
    913  TStopWatch = class
    1014  private
     
    3640  fIsRunning := False;
    3741
     42  {$IFDEF Windows}
    3843  fIsHighResolution := QueryPerformanceFrequency(fFrequency) ;
     44  {$ELSE}
     45  raise Exception.Create('Not implemeneted');
     46  {$ENDIF}
    3947  if NOT fIsHighResolution then fFrequency := MSecsPerSec;
    4048
     
    5058begin
    5159  if fIsHighResolution then
     60    {$IFDEF Windows}
    5261    QueryPerformanceCounter(lInt)
     62    {$ELSE}
     63    raise Exception.Create('Not implemeneted')
     64    {$ENDIF}
    5365  else
    5466    lInt := MilliSecondOf(Now) ;
  • Common/UCommon.pas

    r250 r252  
    66
    77uses
    8   Windows, Classes, SysUtils, SpecializedList, StrUtils, Dialogs,
     8  {$IFDEF Windows}Windows,{$ENDIF}
     9  Classes, SysUtils, SpecializedList, StrUtils, Dialogs,
    910  FileUtil; //, ShFolder, ShellAPI;
    1011
     
    2930  ExceptionHandler: TExceptionEvent;
    3031  DLLHandle1: HModule;
     32
     33{$IFDEF Windows}
    3134  GetUserNameEx: procedure (NameFormat: DWORD;
    3235    lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
    33 
     36{$ENDIF}
    3437
    3538function IntToBin(Data: Cardinal; Count: Byte): string;
     
    4144function BCDToInt(Value: Byte): Byte;
    4245function CompareByteArray(Data1, Data2: TArrayOfByte): Boolean;
     46{$IFDEF Windows}
    4347function GetUserName: string;
    4448function LoggedOnUserNameEx(Format: TUserNameFormat): string;
     49{$ENDIF}
    4550function SplitString(var Text: string; Count: Word): string;
    4651function GetBit(Variable: QWord; Index: Byte): Boolean;
     
    250255end;
    251256
     257{$IFDEF Windows}
    252258function GetUserName: string;
    253259const
     
    283289  end else Result := GetUserName;
    284290end;
     291{$ENDIF}
    285292
    286293function SplitString(var Text: string; Count: Word): string;
     
    317324procedure LoadLibraries;
    318325begin
     326  {$IFDEF Windows}
    319327  DLLHandle1 := LoadLibrary('secur32.dll');
    320328  if DLLHandle1 <> 0 then
     
    322330    @GetUserNameEx := GetProcAddress(DLLHandle1, 'GetUserNameExA');
    323331  end;
     332  {$ENDIF}
    324333end;
    325334
    326335procedure FreeLibraries;
    327336begin
     337  {$IFDEF Windows}
    328338  if DLLHandle1 <> 0 then FreeLibrary(DLLHandle1);
     339  {$ENDIF}
    329340end;
    330341
Note: See TracChangeset for help on using the changeset viewer.