Unit OMPublic

Description

 

Overview

Classes, Interfaces, Objects and Records

Name Description
Record TPersistentInfo  
Packed Record TMemoryStatusEx  
Class TxomSelectDirectoryDialog  
Record TSeasonHelper  

Functions and Procedures

procedure OMPublic_initialization;
procedure OMPublic_finalization;
procedure RotatePointsRad(var APoints: array of TPoint; AOrigin: TPoint; ARadians: Single);
procedure RotatePoints(var APoints: array of TPoint; AOrigin: TPoint; AAngle: Single);
function CenterPoint(ARect: TRect): TPoint;
function RotateRectOverPoint (ARect: TRect; ARotationPoint: TPoint; AAngle: Double; var APolygon: array of TPoint): TRect;
function FitRectInRect (ARect, ABaseRect: TRect): TRect;
function ScaledRect (ARect: TRect; AFactor: Double): TRect;
function RotateRect (ARect: TRect; AAngle: Double; var APolygon: array of TPoint): TRect;
function RotateRectAngle (ARect: TRect; AAngle: Double): TRect;
function RectOffsetRect (ARect: TRect; ABaseRect: TRect): TRect;
function RectWidth (ARect: TRect): Integer;
function RectHeight (ARect: TRect): Integer;
function AngleForPoint (ACenter, APoint: TPoint): Double;
function AngleBetweenPoints(x1, y1, x2, y2: Double): Double;
function IsSameRect (ARect1, ARect2: TRect): Boolean;
function PtrIntToHexStr(const APtrInt: PtrInt; const APrefix: String = '$'): String;
function PtrIntToHexStrW(const APtrInt: PtrInt; const APrefix: WideString = '$'): WideString;
function PtrIntToStr(const APtrInt: PtrInt): String;
function PtrIntToStrW(const APtrInt: PtrInt): WideString;
function StrToPtrInt(const S: String): PtrInt;
function WStrToPtrInt(const S: WideString): PtrInt;
function ObjToStr(const AObj: TObject): String;
function ObjToStrW(const AObj: TObject): WideString;
function StrToObj(const S: String): TObject;
function WStrToObj(const S: WideString): TObject;
procedure RevealFile(const AFileName: WideString);
procedure RevealFiles(AFileNames: TxomStringList);
function IsAppVersion (AMajor, AMinor, ABugfix: Integer): Boolean;
function IsAppBuild (ABuild: Integer): Boolean;
function PlatformArchStr: WideString;
function PlatformStr: WideString;
function IsWinVersion (AMajor, AMinor, ABugFix: Integer): Boolean;
function IsWin2000: Boolean;
function IsWinXP: Boolean;
function IsWinVista: Boolean;
function IsWin7: Boolean;
function IsWin8: Boolean;
function IsWin8_1: Boolean;
function IsWin10: Boolean;
function IsWin11: Boolean;
function OSIs64Bit: Boolean;
function IsMacOSVersion (AMajor, AMinor, ABugfix: Integer): Boolean;
function IsMacOSTiger: Boolean;
function IsMacOSLeopard: Boolean;
function IsMacOSSnowLeopard: Boolean;
function IsMacOSLion: Boolean;
function IsMacOSMountainLion: Boolean;
function IsMacOSMavericks: Boolean;
function IsMacOSYosemite: Boolean;
function IsMacOSElCapitan: Boolean;
function IsMacOSSierra: Boolean;
function IsMacOSHighSierra: Boolean;
function IsMacOSMojave: Boolean;
function IsMacOSCatalina: Boolean;
function IsMacOSBigSur: Boolean;
function IsMacOSMonterey: Boolean;
function IsMacOSVentura: Boolean;
function IsMacOSSonoma: Boolean;
function IsMacOSSequoia: Boolean;
function IsMacOSTahoe: Boolean;
function IsLinux: Boolean;
function IsOSDarkMode: Boolean;
function ReadMacOSTagsForFile(const AFileName: WideString; AResult: TxomStrings): Boolean;
function WriteMacOSTagsForFile(const AFileName: WideString; AResult: TxomStrings): Boolean;
function IsWindowsFilePath(const AFilePath: WideString): Boolean;
function IsPOSIXFilePath(const AFilePath: WideString): Boolean;
function NormalizeWideString(const AStr: WideString): WideString;
function ScreenSaverRunning: Boolean;
procedure CopyTextToClipboard(const AText: WideString);
function CopyTextFromClipboard: WideString;
procedure CopyStreamToClipboard(S: TStream; AFormat: TClipboardFormat = TClipboardFormat(-1));
procedure CopyStreamFromClipboard(S: TStream; AFormat: TClipboardFormat = TClipboardFormat(-1));
function ClipboardHasStream(AFormat: TClipboardFormat = TClipboardFormat(-1)): Boolean;
procedure EnumPathOnEllipseQuart (ARadius: TPoint; var AResult: Array of Integer);
procedure EnumPathOnEllipse (AOffset: TPoint; ARadius: TPoint; var AResult: Array of TPoint);
procedure LoadResourceStream (AResName: String; AType: AnsiString; AStream: TStream);
function LoadResourceString (AResName: String; Encoded: Boolean = False): String;
function GetVolumeName(const AFileName: WideString): WideString;
function IsSwappableDrive (const AFileName: WideString): Boolean;
function GetVolumeSize(const AFileName: WideString): UInt64;
function GetVolumeFreeSpace(const AFileName: WideString): UInt64;
function UNCFileName(const AFileName: WideString): WideString;
function WideExpandUNCFileName(const AFileName: WideString): WideString;
function SearchFiles(const ADir: WideString; const AMask: WideString; const AFrom: TDateTime; AResult: TxomStrings; const ARecursive: Boolean = True; const ADateCheckKind: TDateCheckKind = dckModified; const MaxResults: Integer = -1; AFiltered: TxomStrings = nil): Boolean;
function SearchFolders(const ADir: WideString; const AMask: WideString; AResult: TxomStrings; const ARecursive: Boolean): Boolean;
procedure SwapIntegers(var Value1: LongInt; var Value2: LongInt);
procedure SwapSingles(var Value1: Single; var Value2: Single);
function TokenStringDecode (ATokenString: String): WideString;
function TokenStringEncode (const AString: WideString): String;
procedure Normalize (var AX: LongInt; var AY: LongInt; ATolerance: Single = 0); overload;
procedure Normalize (var AX: LongWord; var AY: LongWord; ATolerance: Single = 0); overload;
procedure Normalize (var AX: Int64; var AY: Int64; ATolerance: Single); overload;
function ShortFileName (const AFileName: WideString; ALengthSwitchSize: Integer = 255): WideString;
function LongFileName (const AFileName: WideString): WideString;
function MatchesMultiMask (const AFileName: WideString; AMultiMasks: WideString): Boolean;
function HTMLEncode(const AString: WideString): WideString;
function HTMLDecode(const AString: WideString): WideString;
function URLEncode(const AString: WideString): AnsiString;
function URLDecode(const AString: String): WideString;
function MulDivFloat(const ANumber, ANumerator, ADenomenator: Single): Single;
function SizeOfFile(const AFileName: WideString): Int64;
function SizeOfFolder(const AFolderName: WideString): Int64;
procedure MatchFileExtensionCase(const ASourceFileName: WideString; var ATargetFileName: WideString);
function DiskFreeSpace(const ADriveName: WideString): Int64;
function DiskFreeSpace(const ADrive: Byte=0): Int64;
function GetDefaultBrowser: String;
function ElevateStart: Boolean;
function ElevateStop: Boolean;
procedure RunApp(const TheApp: Widestring; const How2Show: Integer = 1; const AParams: WideString = ''; const AEnvironment: WideString = '');
function RunCommand (const ACommand: WideString): Integer;
function RunAppAndWait(const TheApp: Widestring; const How2Show: Integer = 1): Integer;
function RunAppAndWaitForOutput(const TheApp: WideString; const AOutput: TStrings = nil; const AShowConsole: Boolean = True): String;
function ProcessExists(const sExe: Widestring): Boolean;
procedure GetProcesses(const ProcessList: TxomStrings);
procedure WaitWhileProcessExists (const sExe: WideString);
function InternetConnected(const AUseStateCache: Boolean = True): Boolean;
function GetOSUserName: String;
procedure ReadOSProxySettings (out AUseProxy: Boolean; out AHost: String; out APort: Integer; out AUser: String; out APassword: String);
function FileStampForFile(const AFileName : WideString; const AType: TFileTimeType; ATimeZoneCorrected: Boolean = True): TDateTime;
function FileStamp (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;
function FileModified (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;
function FileCreated (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;
function FileLastAccessed (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;
function ChangeFileStampForFile(const AFileName : WideString; AFileTime: TDateTime; const AType: TFileTimeType; AIsInLocalTimeZone: Boolean = True): boolean;
function SetFileDate(const FileName: WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;
function SetFileDateCreated(const FileName : WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;
function SetFileDateModified(const FileName : WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;
function StringRepeat (const AStr: WideString; ACount: Integer): WideString;
function AnsiStringRepeat (const AStr: AnsiString; ACount: Integer): AnsiString;
function MingleString(const Input: WideString): WideString;
function BinStrToByte(const ABinStr: String): Byte;
function BinStrToWord(const ABinStr: String): Word;
function BinStrToInt(const ABinStr: String): Integer;
function BinStrToInt64(const ABinStr: String): Int64;
function BinStrToHex(ABinStr: String): String;
function BinStrToStr(ABinStr: String): String;
function ThreadRandom(MaxValue: Integer): Integer;
function RandomRange(const AFrom, ATo: Integer): Integer;
function ZuluDate (ADate: TDateTime): TDateTime;
function DateTimeToUnixStamp(ConvDate: TDateTime): Double;
function UnixToDateTime(USec: Double): TDateTime;
function FileStampGMT (const AFileName: WideString; const AType: TFileTimeType = ftModified): TDateTime;
function DateTimeToFileTime(dt: TDateTime): TFiletime;
function FolderStamp(const Folder: WideString): TDateTime;
function FileTimeToDateTime(const FileTime: TFileTime): TDateTime;
function IsValidFileName(const AName: Widestring): Boolean;
function IsValidEmailAddress(const AEMail: WideString): Boolean;
function GMTOffsetForDate (const ADt: TDateTime): Double;
function GMTDate (ADt: TDateTime): TDateTime;
function WindowsLocaleCode: String;
function WindowsLocaleLCID: Integer;
function WindowsCountryISO: String;
function SafeTime (TheDateTime: TDateTime): TDateTime;
function BeginOfMinute (BaseDate: TDate): TDateTime;
function EndOfMinute (BaseDate: TDate): TDateTime;
function BeginOfHour (BaseDate: TDate): TDateTime;
function EndOfHour (BaseDate: TDate): TDateTime;
function BeginOfDay (BaseDate: TDate): TDateTime;
function EndOfDay (BaseDate: TDate): TDateTime;
function BeginOfWeek (BaseDate: TDate): TDateTime;
function EndOfWeek (BaseDate: TDate): TDateTime;
function BeginOfMonth (BaseDate: TDate): TDateTime;
function EndOfMonth (BaseDate: TDate): TDateTime;
function BeginOfQuarter (BaseDate: TDate): TDateTime;
function EndOfQuarter (BaseDate: TDate): TDateTime;
function BeginOfYear (BaseDate: TDate): TDateTime;
function EndOfYear (BaseDate: TDate): TDateTime;
function BeginOfDecade (BaseDate: TDate): TDateTime;
function EndOfDecade (BaseDate: TDate): TDateTime;
function BeginOfCentury (BaseDate: TDate): TDateTime;
function EndOfCentury (BaseDate: TDate): TDateTime;
function LastDayOfMonth (BaseDate: TDate): Word;
function QuarterNumberOfDate (ADate: TDate): Word;
function DateOfWeekNumber (AYear: Integer; AWeekNumber: Integer): TDateTime;
function WeekNumberOfDate(ADate: TDate): Word;
function FirstDayOfWeek: Integer;
function DayOfYear(ADate: TDate): Integer;
function FormattedStrToDateTime(const AFormat, ADateStr: WideString): TDateTime;
function DateTimeToISODateString (ADateTime: TDateTime; AZoneOffset: Double; AKind: TDateTimeKind = dtkDateTime): WideString;
function ISODateStringToDateTime (AISOString: WideString; out AZoneOffset: Double): TDateTime;
function FloatToISOFloatString (AFloat: Extended): WideString;
function ISOFloatStringToFloat ( AISOString: WideString): Extended;
function GetLongFilename (const AShortFileName: WideString ): WideString;
function UNCToLocalFileName(const AFileName: WideString): WideString;
function UniqueFileName (const AFileName: WideString; const ANumberLength: Integer = -1; const APreSeparator: WideString = '('; const APostSeparator: WideString = ')'; const AMultiDottedExtensionType: TMultiDottedExtensionType = mdetAllParts): WideString;
procedure GetDuration (ADateTime: TDateTime; out days, hours, minutes, seconds, milliseconds: Word);
function GetDurationString (ADateTime: TDateTime; AFormat: TDateParts = [dpDays, dpHours, dpMinutes, dpSeconds]; OnlyFilled: Boolean = False; ShortStrings: Boolean = False): WideString;
function GetDateTimeString (ADateTime: TDateTime; AFormat: TDateParts = [dpDays, dpHours, dpMinutes, dpSeconds]; OnlyFilled: Boolean = False; ShortStrings: Boolean = False): WideString;
procedure MsToTimeValues (AMs: Cardinal; out AHrs: Integer; out AMins: Integer; out ASecs: Integer; out AMils: Integer);
function MsToTimeString (AMs: Cardinal; AParts: TDateParts = [dpMinutes, dpSeconds]; const ASeparator: String = ':'): String;
function TimeStringToMs (const ATimeString, ATimeFormat: String): Cardinal;
function MsToDateTime (AMs: Cardinal): TDateTime;
function DateTimeToMs (ADt: TDateTime): Cardinal;
function LoadFileAsString (const AFileName: WideString): String;
function ShortStringStyle (const AString: WideString; const ALength: Integer = 8; const AFromLeft: Boolean = True; const APreString: WideString = '...'): WideString;
function WindowsSpecialFolder (const AMacroPath: WideString): WideString;
function WindowsHomeDir: WideString;
function WindowsTempDir: WideString;
function WindowsDir: WideString;
function WindowsSystemDir: WideString;
function WindowsMyPicturesDir: WideString;
function WindowsMyDocumentsDir: WideString;
function WindowsMyDownloadsDir: WideString;
function WindowsAppDataDir: WideString;
function WindowsDesktopDir: WideString;
function WindowsCacheDir: WideString;
function WindowsProgramsDir: WideString;
function WindowsSendToDir: WideString;
function IndexInStrings(AString: String; AStrings: TStrings; APartial: Boolean = False; ACaseSensitive: Boolean = False): Integer;
function ParseVars (AString: WideString; AVars: TxomStrings; AValues: TxomStrings): WideString;
function DecimalFrac (ANum: Extended): Integer;
function FracInteger (ANum: Extended; APrecision: Integer = 6): Integer;
function RoundToPrecision (ANum: Extended; APrecision: Integer): Extended;
function RoundToPrecisionForRange(const AValue: Double; const AMinRange, AMaxRange: Double): Double;
function CaretSystemPosition(var APoint: TPoint): Boolean;
function ConstrainInt (AVal: Integer; AMin, AMax: Integer): Integer;
function ConstrainInt64 (AVal: Int64; AMin, AMax: Int64): Int64;
function ConstrainFloat (AVal: Double; AMin, AMax: Double): Double;
function BetweenInt (AVal: Integer; AMin, AMax: Integer): Boolean;
function BetweenFloat (AVal: Double; AMin, AMax: Double): Boolean;
function BinaryCompare(const AStream1, AStream2: TStream; const AOnProgress: TSimpleProgressEvent = nil; const AProgressId: WideString = ''; const AStartPos: Int64 = 0; const AQuick: Boolean = False): Boolean;
function BinaryCompareFiles(const AFile1, AFile2: WideString; const AProgress: TSimpleProgressEvent = nil; const AProgressId: WideString = ''; const AStartPos: Int64 = 0; const AQuick: Boolean = False): Boolean;
function CheckBit (AValue: Integer; ABitNr: Byte): Boolean;
function ByteToBinary(AByte: Byte): TBitArray;
function BinaryToByte(ABits: TBitArray): Byte;
function IntToBinaryString (AValue: Integer): String;
function WordToBinaryString (AValue: Integer): String;
function ByteToBinaryString (AValue: Integer): String;
function ByteToFloat8 (const AByte: Byte): Single;
function WordToFloat16 (const AWord: Word): Single;
function CardinalToFloat32 (const ACardinal: Cardinal): Single;
function FindJpegScale (ARequiredSize: Integer; AWidth: Integer; AHeight: Integer): TomJPEGScale;
function ExtractWord (const AText: WideString; const AWordNr: Integer; const ASeparator: WideString = ' '): WideString;
function DateToStrW (ADate: TDateTime): WideString; overload;
function DateToStrW (ADate: TDateTime; AFormatSettings: TFormatSettings): WideString; overload;
function TimeToStrW (ATime: TDateTime): WideString; overload;
function TimeToStrW (ATime: TDateTime; AFormatSettings: TFormatSettings): WideString; overload;
function FormatDateTimeW(const AFormatStr: String; ADateTime: TDateTime): WideString; overload;
function FormatDateTimeW(const AFormatStr: String; ADateTime: TDateTime; const AFormatSettings: TFormatSettings): WideString; overload;
function IntToStrW (const AInt: Integer): WideString; overload;
function IntToStrW (const AInt: Int64): WideString; overload;
function IntToStrW (const AInt: Qword): WideString; overload;
function IntToStrA (AInt: Integer): AnsiString; overload;
function IntToStrA (AInt: Int64): AnsiString; overload;
function WStrToInt (const AStr: WideString): Integer;
function WStrToInt64(const AStr: WideString): Int64;
function WStrToFloat(const AStr: WideString): Extended; overload;
Function WStrToFloat(const AStr: WideString; const AFormatSettings: TFormatSettings) : Extended; overload;
function StrToHex (const AStr: String): AnsiString;
function HexToStr (const AHexStr: AnsiString): String;
function WideStrToHex (const AStr: WideString): String;
function HexToWideStr (const AHexStr: String): WideString;
procedure HexToStream (const AHexStr: String; AStream: TStream);
function StreamToHex(AStream: TStream): String;
function HashCode(const s: String; Seed: LongWord=$9747b28c): Int64;
function HashStringForStream(const AStream: TStream; AHashLength: Integer = 8; AStreamCount: Int64 = 0; AStartPos: Int64 = 0; AAsHex: Boolean = False): AnsiString;
function HashStringForFile(const AFileName: WideString; AByteCount: Int64 = 1024*10): String;
function QuickHashStringForStream(const AStream: TStream): String;
function QuickHashStringForFile(const AFileName: WideString): String;
function HashStringForFileList (AFiles: TxomStringList; AByteCountPerFile: Int64 = 1024*10): String;
function HashStringForFolder (AFolder: WideString; ARecursive: Boolean): String;
function HashStr(const StringIn: PAnsiChar; AHashLength: Integer = 8): String;
function HashString(const AString: AnsiString; AHashLength: Integer = 8): String;
function WideHashString(const AString: WideString; AHashLength: Integer = 8): String;
function SHA256HashFromStream (AStream: TStream): String;
function SHA256Hash (const AString: WideString): String;
function HMACSHA1_Base64(const AKey, AMessage: string): string;
function ChecksumForStream (AStream: TStream): String;
function ChecksumForFile (const AFileName: WideString): String;
function Base64Encode (const AString: String): String;
function Base64Decode (const AString: String): String;
procedure Base64EncodeStreamToStream (AStream, AResult: TStream; ALineLength: Integer = 0);
function Base64EncodeStream (AStream: TStream): AnsiString;
procedure Base64DecodeString (const AString: String; AStream: TStream; AStrict: Boolean = False);
function FileNameToURI(const AFileName: WideString): AnsiString;
function EncryptStream (const AKey: AnsiString; AStream, AOutput: TStream): Int64;
function DecryptStream (const AKey: AnsiString; AStream, AOutput: TStream): Int64;
function EncryptString (const AKey: AnsiString; const AString: AnsiString): AnsiString;
function DecryptString (const AKey: AnsiString; const AString: AnsiString): AnsiString;
procedure WriteVariantToStream(const AValue: Variant; AStream: TStream);
function ReadVariantFromStream(AStream: TStream): Variant;
procedure SetApplicationCode (const Value: String);
procedure SetCompany (const Value: String);
function GetApplicationCode: String;
function GetCompany: String;
procedure RenameCompany (const AOldName, ANewName: String);
function DefaultConfigDir: WideString;
function DefaultAppDataDir: WideString;
function DefaultResourceDir: WideString;
function DefaultApplicationDir: WideString;
function DefaultLogDir: WideString;
function RegistryKey: String;
function ReadFromRegistry (const sSection, sKeyValue: String; DefaultValue: Variant): Variant;
function ReadStreamFromRegistry (const sSection, sKeyValue: String; AStream: TStream): Boolean;
procedure WriteToRegistry (const sSection, sKeyValue: String; Value: Variant);
procedure WriteStreamToRegistry (const sSection, sKeyValue: String; AStream: TStream);
procedure DeleteFromRegistry (const sSection, sKeyValue: String);
function RegistryKeyExists (const sSection, sKeyValue: String): Boolean;
procedure EnumKeysFromRegistry (const sSection: String; sKeyValues: TStrings);
procedure EnumValuesFromRegistry (const sSection: String; sValues: TStrings);
procedure RenameRegistryValue (const sSection, sKeyValue, ANewName: String);
function BackupRegistry (const AFileName: WideString): Boolean;
function RestoreRegistry (const AFileName: WideString): Boolean;
procedure RegistryBeginUpdate;
procedure RegistryEndUpdate;
function Val (const vInput: Variant): Variant;
function VarIsNull(const V: Variant): Boolean;
function VarIsEmpty(const V: Variant): Boolean;
function QuotedStrW (const AStr: WideString): WideString;
function Tokenize(sStr, sSeperator: WideString; AStrings: TxomStrings): Integer;
function AnsiTokenize(sStr, sSeperator: String; AStrings: TStrings): Integer;
function TokenizeSpecial (const sStr: WideString; AStrings: TxomStrings; AMinimumTokenLength: Integer = 0): Integer;
function FormatToProperCSV (const AString: WideString; const ADelimiter: WideChar = ','; AQuoteChar: WideChar = '"'; const ADelimiterEscapeCharacter: WideChar = '\'): WideString;
function StrTran (const sSourceStr, sSeekStr, sReplaceStr: WideString): WideString;
function EscapeString(const value: string): string;
function Escape(const Value: Widestring): string;
function UnEscape(const Value: AnsiString): Widestring;
function StripJsonSlashComments(const S: Ansistring): AnsiString;
function FileMimeType (const AFileName: WideString): WideString;
function iif(const ACondition: Boolean; const ATrueValue, AFalseValue: Variant): Variant;
function Nvl(const AValue: Variant; const ADefaultValue: Variant): Variant;
function AddLeadingChars(const AStr: WideString; ALeadChr: WideString; const ALength: Integer; const DoAfter: Boolean = False): WideString;
function RemoveLeadingChars(const AStr: WideString; ALeadChr: WideString): WideString;
function ReadLine (AStream: TStream; var AString: AnsiString): Boolean;
procedure WriteLine (AStream: TStream; const sLine: WideString);
function SeekInStream (AStream: TStream; sText: WideString): boolean;
function FindTextInStream(AStream: TStream; Offset: int64; const AString: AnsiString; CaseSensitive: boolean = True): int64;
function ArrayIntScan (const AArray: Array of Integer; nValue: Integer): Integer;
function ArrayToString (const AArray: TDynamicStringArray; const ASeparator: String): String;
procedure StringToArray (const AString, ASeparator: String; var AArray: TDynamicStringArray);
function GetLocalMachineName: WideString;
function PreventComputerFromSleeping: PtrInt;
procedure UndoPreventComputerFromSleeping(const AActivity: PtrInt);
function IsFileExcludedFromBackup(const AFileName: WideString; var AError: WideString): Boolean;
function ExcludeFileFromBackup(const AFileName: WideString; var AError: WideString): Boolean;
function IncludeFileInBackup(const AFileName: WideString; var AError: WideString): Boolean;
function IsFolderExcludedFromBackup(const AFolder: WideString; var AError: WideString): Boolean;
function ExcludeFolderFromBackup(const AFolder: WideString; var AError: WideString): Boolean;
function IncludeFolderInBackup(const AFolder: WideString; var AError: WideString): Boolean;
function IsDevelopMode: Boolean;
function CompareInt (AInt1, AInt2: Integer): Integer;
function CompareInt64 (AInt1, AInt2: Int64): Integer;
function IsValidNumberString (const ANumberStr: WideString; AIsHex: Boolean = False; ADecimalSeparator: String = ''; AAllowSigned: Boolean = True): Boolean;
function IsValidIntNumberString (const ANumberStr: WideString; AIsHex: Boolean = False; AAllowSigned: Boolean = True): Boolean;
function IsValidRationalString(const AStr: WideString): Boolean;
function IsValidRationalStringValues(const AStr: WideString; var ANom, ADenom: Double): Boolean;
function InitCaps(const AText: WideString): WideString;
function HexToInt(const HexStr: WideString): Cardinal;
function HexToSignedInt(const HexStr: string; byteSize: Integer): Variant;
function SignedIntToHex(value: Int64; byteSize: Integer): String;
function RangedInteger(AValue, MinValue, MaxValue: Integer): Integer;
procedure BackupFile (const AFileName: WideString; const ATargetPath: WideString = '');
function GetSizeString (ASize: Int64; SizeStyle: TSizeStyle = ssChoose; AddStyleIndicator: Boolean = True): WideString;
function SizeString (ASize: Int64): WideString;
function TimePassedString (ADelta: TDateTime): WideString;
function StrAsDate (const AStr: String): TDate;
function CreateClassID(AClean: Boolean = False): string;
function NewGUID(AClean: Boolean = True): String;
function IsSameGUID(const AGuid1, AGuid2: TGUID): Boolean;
function ExtractNumberFromString(const AString: WideString; const AFormatSettings: TFormatSettings; var AResult: Double): Boolean;
function ExtractNumbersInString(const AString: WideString): WideString;
function OSPlatform: WideString;
function OSTrivialName: WideString;
function OSVersion: WideString;
function OpenHTTPAddress (AHandle: HWND; const AHTTPAddress: WideString): Integer;
function ExecuteWaitFile( const ExeFile, Parameters: string): Boolean;
function ShellDoExecuteOperation (AHandle: HWND; const AExecuteCommand, AOperation: WideString): Integer;
function ShellDoExecute (AHandle: HWND; const AExecuteCommand: WideString): Integer;
function GetStartButton: HWND;
function OSTimeZoneName: WideString;
function OSCountryCode: WideString;
function OSMeasurementSystem: TMeasurementSystem;
function InstalledMemory(InMegabytes: Boolean = False): Int64;
function AvailableMemory(InMegabytes: Boolean = False): Int64;
function CurrentMemoryUsage: Int64;
function InstalledProcessors: Cardinal;
function UniqueSystemID: String;
function HTMLStrip ( AHTML: WideString): WideString;
procedure RegisterDLL (const AActiveXFileName: WideString);
procedure UnregisterDLL (const AActiveXFileName: WideString);
function IsRunningAsService: Boolean;
function IsRunningAsDLL: Boolean;
function InstanceLibraryName: String;
function BuildValidFileName(const AFileName: WideString; ADrastic: Boolean = True): WideString;
function FixFileName ( AFileName: WideString): WideString;
function FindStringInStream(AStream: TStream; const AID: AnsiString; out APosition: Int64; AOffset: Int64 = 0; AReversed: Boolean = False; AInstanceCount: Integer = 1; AStopPosition: Int64 = 0): Boolean;
function CopyStreamInBlocks(ASource, ATarget: TStream; ACopyBytes: Int64; const ABlockSize: Int64 = 1024 * 100): Int64;
procedure InvertBuffer (var ABuffer: Array of Byte; ALength: Integer);
procedure InvertBuffer2 (var ABuffer: Array of Char; ALength: Integer);
function StreamRead (AStream: TStream; out ABuffer: Array of Byte; ACount: Integer; AOrder: TByteOrder): Integer;
function StreamRead2 (AStream: TStream; var ABuffer: Array of Char; ACount: Integer; AOrder: TByteOrder): Integer;
function StreamWrite (AStream: TStream; var ABuffer: Array of Byte; ACount: Integer; AOrder: TByteOrder): Integer;
function StreamWrite2 (AStream: TStream; var ABuffer: Array of Char; ACount: Integer; AOrder: TByteOrder): Integer;
function StreamInvert (AStream: TStream; AOrder: TByteOrder; BlockSize: Integer = -1): Integer;
function StreamInvertBlock (AStream: TStream; BlockSize: Integer = -1): Integer;
procedure StreamReadUInt64 (AStream: TStream; out AInt: QWord; AOrder: TByteOrder);
procedure StreamWriteUInt64 (AStream: TStream; AInt: QWord; AOrder: TByteOrder);
procedure StreamReadInt64 (AStream: TStream; out AInt: Int64; AOrder: TByteOrder);
procedure StreamWriteInt64 (AStream: TStream; AInt: Int64; AOrder: TByteOrder);
procedure StreamReadUInt32 (AStream: TStream; out AInt: Cardinal; AOrder: TByteOrder);
procedure StreamWriteUInt32 (AStream: TStream; AInt: Cardinal; AOrder: TByteOrder);
procedure StreamReadInt32 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
procedure StreamWriteInt32 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
procedure StreamReadInt16 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
procedure StreamWriteInt16 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
procedure StreamReadUInt16 (AStream: TStream; out AInt: Word; AOrder: TByteOrder);
procedure StreamWriteUInt16 (AStream: TStream; AInt: Word; AOrder: TByteOrder);
procedure StreamReadUInt8 (AStream: TStream; out AInt: Byte; AOrder: TByteOrder);
procedure StreamWriteUInt8 (AStream: TStream; AInt: Byte; AOrder: TByteOrder);
procedure StreamReadUIntVar (AStream: TStream; out AInt: QWord; ASize: Byte; AOrder: TByteOrder);
procedure StreamWriteUIntVar (AStream: TStream; AInt: QWord; ASize: Byte; AOrder: TByteOrder);
procedure StreamReadInt8 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
procedure StreamWriteInt8 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
procedure StreamReadFloat32 (AStream: TStream; out AFloat: Single; AOrder: TByteOrder);
procedure StreamWriteFloat32 (AStream: TStream; AFloat: Single; AOrder: TByteOrder);
procedure InitLanguage;

Types

WideChar = System.WideChar;
TBitArray = Array[1..8] of Boolean;
TDynamicStringArray = Array of String;
TFileTimeType = (...);
TMultiDottedExtensionType = (...);
TSimpleProgressEvent = procedure (Sender: TObject; AId: WideString; APosition: Integer; var ACancel: Boolean) of object;
TProxySettingsEvent = procedure (out AUseProxy: Boolean; out AHost: String; out APort: Integer; out AUser: String; out APassword: String) of object;
TSystemUIMode = (...);
TSystemUIOption = (...);
TSystemUIOptions = set of TSystemUIOption;
TSeason = (...);
TSeasons = set of TSeason;

Constants

ssMultiSelect : TShiftStateEnum = ssMeta;
CrLf : AnsiString = #13#10;
CrLf2 : AnsiString = #13#10#13#10;
LfCr : AnsiString = #10#13;
LfCr2 : AnsiString = #10#13#10#13;
CrLfW : WideString = System.WideChar(#13) + System.WideChar(#10);
CrLf2W : WideString = System.WideChar(#13) + System.WideChar(#10) + System.WideChar(#13) + System.WideChar(#10);
LfCrW : WideString = System.WideChar(#10) + System.WideChar(#13);
LfCr2W : WideString = System.WideChar(#10) + System.WideChar(#13) + System.WideChar(#10) + System.WideChar(#13);
DefaultTimeZone: Double = -9999;

Variables

StartupMoment: TDateTime = 0.0;
ComputerGUID: String = '';
RunSessionGUID: String = '';
IsServerOS: Boolean = False;
TimeZoneOffset: Double;
VistaDialogsEnabled: Boolean;
gClipbrdFormat: TClipboardFormat;
gClipbrdTextFormat: TClipboardFormat;
GlobalProxySettings: TProxySettingsEvent = nil;
IntlFormatSettings: TFormatSettings = ( CurrencyFormat: 1; NegCurrFormat: 5; ThousandSeparator: ','; DecimalSeparator: '.'; CurrencyDecimals: 2; DateSeparator: '/'; TimeSeparator: ':'; ListSeparator: ','; CurrencyString: '$'; ShortDateFormat: 'd/m/y'; LongDateFormat: 'dd" "mmmm" "yyyy'; TimeAMString: 'AM'; TimePMString: 'PM'; ShortTimeFormat: 'hh:nn'; LongTimeFormat: 'hh:nn:ss'; ShortMonthNames: ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'); LongMonthNames: ('January','February','March','April','May','June', 'July','August','September','October','November','December'); ShortDayNames: ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); LongDayNames: ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); TwoDigitYearCenturyWindow: 50; );

Description

Functions and Procedures

procedure OMPublic_initialization;
 
procedure OMPublic_finalization;
 
procedure RotatePointsRad(var APoints: array of TPoint; AOrigin: TPoint; ARadians: Single);

rotate a number of points over a specified origin (center point) and a specified radians angle

procedure RotatePoints(var APoints: array of TPoint; AOrigin: TPoint; AAngle: Single);

rotate a number of points over a specified origin (center point) and a specified degrees angle

function CenterPoint(ARect: TRect): TPoint;

return the center point of the given rectangle

function RotateRectOverPoint (ARect: TRect; ARotationPoint: TPoint; AAngle: Double; var APolygon: array of TPoint): TRect;

rotate a rectangle over a specific rotation point

function FitRectInRect (ARect, ABaseRect: TRect): TRect;

fit a rectangle inside a rectangle (Best Fit). ARect is the rectangle to fit inside the ABaseRect

function ScaledRect (ARect: TRect; AFactor: Double): TRect;

scale a rect with a specified factor, center based

function RotateRect (ARect: TRect; AAngle: Double; var APolygon: array of TPoint): TRect;

rotate a rect over an abitrary ange and returns the rotation points as a polygon { SetLength(APolygon, 4) }. The function result is the outer rect of the rotated rect

function RotateRectAngle (ARect: TRect; AAngle: Double): TRect;
 
function RectOffsetRect (ARect: TRect; ABaseRect: TRect): TRect;

return the ARect relative to the ABaseRect position

function RectWidth (ARect: TRect): Integer;
 
function RectHeight (ARect: TRect): Integer;
 
function AngleForPoint (ACenter, APoint: TPoint): Double;

return the angle for a specific point, relative to a specific center point

function AngleBetweenPoints(x1, y1, x2, y2: Double): Double;

return the andle between two points

function IsSameRect (ARect1, ARect2: TRect): Boolean;

return if two rects are the same or not

function PtrIntToHexStr(const APtrInt: PtrInt; const APrefix: String = '$'): String;
 
function PtrIntToHexStrW(const APtrInt: PtrInt; const APrefix: WideString = '$'): WideString;
 
function PtrIntToStr(const APtrInt: PtrInt): String;
 
function PtrIntToStrW(const APtrInt: PtrInt): WideString;
 
function StrToPtrInt(const S: String): PtrInt;
 
function WStrToPtrInt(const S: WideString): PtrInt;
 
function ObjToStr(const AObj: TObject): String;
 
function ObjToStrW(const AObj: TObject): WideString;
 
function StrToObj(const S: String): TObject;
 
function WStrToObj(const S: WideString): TObject;
 
procedure RevealFile(const AFileName: WideString);

reveal a file in WindowsExplorer or Mac-Finder

procedure RevealFiles(AFileNames: TxomStringList);
 
function IsAppVersion (AMajor, AMinor, ABugfix: Integer): Boolean;

returns if the current application complies with a version number

function IsAppBuild (ABuild: Integer): Boolean;

returns if the current application complies with a build

function PlatformArchStr: WideString;

returns a string that represents the architecture of this platform

function PlatformStr: WideString;

returns a string to represent this OS platform

function IsWinVersion (AMajor, AMinor, ABugFix: Integer): Boolean;

returns if the current OS complies

function IsWin2000: Boolean;

returns if the current OS is Windows 2000

function IsWinXP: Boolean;

returns if the current OS is Windows XP

function IsWinVista: Boolean;

returns if the current OS is Windows Vista

function IsWin7: Boolean;

returns if the current OS is Windows 7

function IsWin8: Boolean;

returns if the current OS is Windows 8

function IsWin8_1: Boolean;

returns if the current OS is Windows 8.1

function IsWin10: Boolean;

returns if the current OS is Windows 10

function IsWin11: Boolean;

returns if the current OS is Windows 11

function OSIs64Bit: Boolean;

returns if the current OS is a 64 bits version or not

function IsMacOSVersion (AMajor, AMinor, ABugfix: Integer): Boolean;

returns if the current OS complies

function IsMacOSTiger: Boolean;

returns if the current OS is a MacOSX Tiger 10.4

function IsMacOSLeopard: Boolean;

returns if the current OS is a MacOSX Leopard 10.5

function IsMacOSSnowLeopard: Boolean;

returns if the current OS is a MacOSX Snow Leopard 10.6

function IsMacOSLion: Boolean;

returns if the current OS is a MacOSX Lion 10.7

function IsMacOSMountainLion: Boolean;

returns if the current OS is a MacOSX Mountain Lion 10.8

function IsMacOSMavericks: Boolean;

returns if the current OS is a MacOSX Maverick 10.9

function IsMacOSYosemite: Boolean;

returns if the current OS is a MacOSX Yosemite 10.10

function IsMacOSElCapitan: Boolean;

returns if the current OS is a MacOSX El Capitan 10.11

function IsMacOSSierra: Boolean;

returns if the current OS is a MacOSX Sierra 10.12

function IsMacOSHighSierra: Boolean;

returns if the current OS is a MacOSX High Sierra 10.13

function IsMacOSMojave: Boolean;

returns if the current OS is a MacOSX Mojave 10.14

function IsMacOSCatalina: Boolean;

returns if the current OS is a MacOSX Catalina 10.15

function IsMacOSBigSur: Boolean;

returns if the current OS is a MacOSX BigSur 11.0 (but also 10.16.0)

function IsMacOSMonterey: Boolean;

returns if the current OS is a MacOSX Monterey 12.0

function IsMacOSVentura: Boolean;

returns if the current OS is a MacOSX Venture 13.0

function IsMacOSSonoma: Boolean;

returns if the current OS is a MacOSX Sonoma 14.0

function IsMacOSSequoia: Boolean;

returns if the current OS is a MacOSX Sequoia 15.0

function IsMacOSTahoe: Boolean;

returns if the current OS is a MacOSX Tahoe 26.0

function IsLinux: Boolean;

returns if the current OS is linux

function IsOSDarkMode: Boolean;

returns if the OS runs in DarkMode

function ReadMacOSTagsForFile(const AFileName: WideString; AResult: TxomStrings): Boolean;

reads the Tags that are defined as extended attributes in macOS

function WriteMacOSTagsForFile(const AFileName: WideString; AResult: TxomStrings): Boolean;

writes the Tags that are defined as extended attributes in macOS

function IsWindowsFilePath(const AFilePath: WideString): Boolean;

returns if a filepath is a Windows file path style

function IsPOSIXFilePath(const AFilePath: WideString): Boolean;

returns if a filepath is a POSIX file path style

function NormalizeWideString(const AStr: WideString): WideString;

returns a normalized unicode string (NFC unicode format)

function ScreenSaverRunning: Boolean;

function CreateEnvironmentBlock(var lpEnvironment:Pointer;hToken:THandle;bInherit:BOOL):BOOL; stdcall; external 'userenv.dll'; function DestroyEnvironmentBlock(pEnvironment:Pointer):BOOL; stdcall; external 'userenv.dll'; returns if the screensaver is currently running or not

procedure CopyTextToClipboard(const AText: WideString);

set a text on the cipboard

function CopyTextFromClipboard: WideString;

get a text from the cipboard

procedure CopyStreamToClipboard(S: TStream; AFormat: TClipboardFormat = TClipboardFormat(-1));

copy a stream to the Windows Clipboard

procedure CopyStreamFromClipboard(S: TStream; AFormat: TClipboardFormat = TClipboardFormat(-1));

copy a stream from the Windows Clipboard to a Stream

function ClipboardHasStream(AFormat: TClipboardFormat = TClipboardFormat(-1)): Boolean;

returns if the clipboard contains a stream

procedure EnumPathOnEllipseQuart (ARadius: TPoint; var AResult: Array of Integer);

the result contains an array of X values per Y value for one quart (0-90 degs) AResult should have the size of the Radius-Y value; e.g. SetLength(AResult, Radius.Y+1)

procedure EnumPathOnEllipse (AOffset: TPoint; ARadius: TPoint; var AResult: Array of TPoint);

the result contains an array of X values per Y value for a full ellipse (0-360 degs) AResult should have the size of 4*Radius-Y value; e.g. SetLength(AResult, 4*(Radius.Y+1))

procedure LoadResourceStream (AResName: String; AType: AnsiString; AStream: TStream);

load a resource name, of a specific type to a stream

function LoadResourceString (AResName: String; Encoded: Boolean = False): String;

load a resource name, and return the string (the type will always be TEXT). Optionally specify in the content is encoded or not

function GetVolumeName(const AFileName: WideString): WideString;
 
function IsSwappableDrive (const AFileName: WideString): Boolean;

returns True if a specific file is stored on a non-internal medium

function GetVolumeSize(const AFileName: WideString): UInt64;
 
function GetVolumeFreeSpace(const AFileName: WideString): UInt64;
 
function UNCFileName(const AFileName: WideString): WideString;
 
function WideExpandUNCFileName(const AFileName: WideString): WideString;
 
function SearchFiles(const ADir: WideString; const AMask: WideString; const AFrom: TDateTime; AResult: TxomStrings; const ARecursive: Boolean = True; const ADateCheckKind: TDateCheckKind = dckModified; const MaxResults: Integer = -1; AFiltered: TxomStrings = nil): Boolean;

search through a specific directory and return all matching files in a stringlist

function SearchFolders(const ADir: WideString; const AMask: WideString; AResult: TxomStrings; const ARecursive: Boolean): Boolean;
 
procedure SwapIntegers(var Value1: LongInt; var Value2: LongInt);
 
procedure SwapSingles(var Value1: Single; var Value2: Single);
 
function TokenStringDecode (ATokenString: String): WideString;

convert a streamed tokenstring to a de-parsed widestring ('Hello'#32'World' will return Hello World)

function TokenStringEncode (const AString: WideString): String;

convert a wide string to a parsed tokenstring (Hello World could become 'Hello'#32'World' )

procedure Normalize (var AX: LongInt; var AY: LongInt; ATolerance: Single = 0); overload;

normalize 2 existing numbers

procedure Normalize (var AX: LongWord; var AY: LongWord; ATolerance: Single = 0); overload;
 
procedure Normalize (var AX: Int64; var AY: Int64; ATolerance: Single); overload;
 
function ShortFileName (const AFileName: WideString; ALengthSwitchSize: Integer = 255): WideString;

return the short file name version (8.3) or a file name

function LongFileName (const AFileName: WideString): WideString;

convert a short file name (8.3) to a long filename

function MatchesMultiMask (const AFileName: WideString; AMultiMasks: WideString): Boolean;

check if a file name matches agains any of multiple masks (comma separated!)

function HTMLEncode(const AString: WideString): WideString;

encode a string to HTML

function HTMLDecode(const AString: WideString): WideString;

decode an encoded HTML string

function URLEncode(const AString: WideString): AnsiString;

encode a string to URL

function URLDecode(const AString: String): WideString;

decode an encoded URL string

function MulDivFloat(const ANumber, ANumerator, ADenomenator: Single): Single;

multiply-division for floats

function SizeOfFile(const AFileName: WideString): Int64;

get the size of a file

function SizeOfFolder(const AFolderName: WideString): Int64;

retrieve the size of a folder (recursive)

procedure MatchFileExtensionCase(const ASourceFileName: WideString; var ATargetFileName: WideString);

make the file extension's letter case the same for two files

function DiskFreeSpace(const ADriveName: WideString): Int64;

retrieve the free diskspace of a drive. Windows works with drive letters, MacOS with drive numbers

function DiskFreeSpace(const ADrive: Byte=0): Int64;
 
function GetDefaultBrowser: String;

get the filename of the installed default browser

function ElevateStart: Boolean;

gain temporary admin rights for application

function ElevateStop: Boolean;

release the elevated rights

procedure RunApp(const TheApp: Widestring; const How2Show: Integer = 1; const AParams: WideString = ''; const AEnvironment: WideString = '');

run an application

function RunCommand (const ACommand: WideString): Integer;
 
function RunAppAndWait(const TheApp: Widestring; const How2Show: Integer = 1): Integer;

run an application and wait for it to terminate

function RunAppAndWaitForOutput(const TheApp: WideString; const AOutput: TStrings = nil; const AShowConsole: Boolean = True): String;

run an application and capture the output

function ProcessExists(const sExe: Widestring): Boolean;

check if a certain process name exists in Windows (e.g. IEXPLORE.EXE)

procedure GetProcesses(const ProcessList: TxomStrings);

Enumerate all running processes in Windows

procedure WaitWhileProcessExists (const sExe: WideString);

halt the application until a process with a specifc name (e.g. IEXPORE.EXE) is closed

function InternetConnected(const AUseStateCache: Boolean = True): Boolean;

check if computer is connected to the internet through modem, LAN or proxy

function GetOSUserName: String;

get the username of the currently logged in user

procedure ReadOSProxySettings (out AUseProxy: Boolean; out AHost: String; out APort: Integer; out AUser: String; out APassword: String);

read the proxy settings from IE

function FileStampForFile(const AFileName : WideString; const AType: TFileTimeType; ATimeZoneCorrected: Boolean = True): TDateTime;

Get Filetime for Created OR Modified OR Accessed

function FileStamp (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;

get the timestamp (modified) of a file

function FileModified (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;

get modified date of a file

function FileCreated (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;

get created date of a file

function FileLastAccessed (const AFileName: WideString; ATimeZoneCorrected: Boolean = True): TDateTime;

get date that the file was last accessed

function ChangeFileStampForFile(const AFileName : WideString; AFileTime: TDateTime; const AType: TFileTimeType; AIsInLocalTimeZone: Boolean = True): boolean;

Set Filetime for Created OR Modified OR Accessed

function SetFileDate(const FileName: WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;

set created date of a file

function SetFileDateCreated(const FileName : WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;

set created date of a file

function SetFileDateModified(const FileName : WideString; const FileDate : TDateTime; AIsInLocalTimeZone: Boolean = True): Boolean;

set modified date of a file

function StringRepeat (const AStr: WideString; ACount: Integer): WideString;

repeat a string for a n number of times

function AnsiStringRepeat (const AStr: AnsiString; ACount: Integer): AnsiString;

repeat an ansi string for a n number of times

function MingleString(const Input: WideString): WideString;

randomly rearange the letters in a string

function BinStrToByte(const ABinStr: String): Byte;

convert a binary string to a byte (8 bits; eg 10010110)

function BinStrToWord(const ABinStr: String): Word;

convert a binary string to a word (16 bits)

function BinStrToInt(const ABinStr: String): Integer;

convert a binary string to a integer (32 bits)

function BinStrToInt64(const ABinStr: String): Int64;

convert a binary string to a 64 bit integer (64 bit)

function BinStrToHex(ABinStr: String): String;

convert a binary string to a hexadecimal string

function BinStrToStr(ABinStr: String): String;

convert a binary string to a ansi string

function ThreadRandom(MaxValue: Integer): Integer;
 
function RandomRange(const AFrom, ATo: Integer): Integer;
 
function ZuluDate (ADate: TDateTime): TDateTime;

get the zero (Zulu = Z in the military) date for a specific date

function DateTimeToUnixStamp(ConvDate: TDateTime): Double;

convert a date time to unix time value

function UnixToDateTime(USec: Double): TDateTime;

convert unix time value to a delphi Date Time

function FileStampGMT (const AFileName: WideString; const AType: TFileTimeType = ftModified): TDateTime;

get the timestamp of a file GMT+0 based

function DateTimeToFileTime(dt: TDateTime): TFiletime;
 
function FolderStamp(const Folder: WideString): TDateTime;

get the time stamp of a folder

function FileTimeToDateTime(const FileTime: TFileTime): TDateTime;
 
function IsValidFileName(const AName: Widestring): Boolean;

return if a specified filename is valid or not

function IsValidEmailAddress(const AEMail: WideString): Boolean;

return if a specified email address is valid or not

function GMTOffsetForDate (const ADt: TDateTime): Double;

use this function to get the GMT offset for a specific date; Daylight saving is taken into account

function GMTDate (ADt: TDateTime): TDateTime;

use this function to get a GMT date for a specific date; Daylight saving is taken into account and the result will be the date corrected to GMT+0

function WindowsLocaleCode: String;

query the Windows locale code

function WindowsLocaleLCID: Integer;

query the Windows Locale ID

function WindowsCountryISO: String;

query the country abbreviation of the Windows Systems

function SafeTime (TheDateTime: TDateTime): TDateTime;

use this function to eliminate time rounding errors

function BeginOfMinute (BaseDate: TDate): TDateTime;

get the date of the begin of a minute

function EndOfMinute (BaseDate: TDate): TDateTime;

get the date of the end of a minute

function BeginOfHour (BaseDate: TDate): TDateTime;

get the date of the begin of a hour

function EndOfHour (BaseDate: TDate): TDateTime;

get the date of the end of a hour

function BeginOfDay (BaseDate: TDate): TDateTime;

get the date of the begin of a day

function EndOfDay (BaseDate: TDate): TDateTime;

get the date of the end of a day

function BeginOfWeek (BaseDate: TDate): TDateTime;

get the date of the first day of the week for a date

function EndOfWeek (BaseDate: TDate): TDateTime;

get the date of the last day of the week for a date

function BeginOfMonth (BaseDate: TDate): TDateTime;

get the date of the first day of the month for a date

function EndOfMonth (BaseDate: TDate): TDateTime;

get the date of the last day of the month for a date

function BeginOfQuarter (BaseDate: TDate): TDateTime;

get the date of the first day of the quarter for a date

function EndOfQuarter (BaseDate: TDate): TDateTime;

get the date of the last day of the quarter for a date

function BeginOfYear (BaseDate: TDate): TDateTime;

get the date of the first day of a year for a date

function EndOfYear (BaseDate: TDate): TDateTime;

get the date of the last day of the year for a date

function BeginOfDecade (BaseDate: TDate): TDateTime;

get the date of the first day of the decade for a date

function EndOfDecade (BaseDate: TDate): TDateTime;

get the date of the last day of the decade for a date

function BeginOfCentury (BaseDate: TDate): TDateTime;

get the date of the first day of the century for a date

function EndOfCentury (BaseDate: TDate): TDateTime;

get the date of the last day of the century for a date

function LastDayOfMonth (BaseDate: TDate): Word;

get the last day of the month for a date

function QuarterNumberOfDate (ADate: TDate): Word;

get the quarternumber of a specific date

function DateOfWeekNumber (AYear: Integer; AWeekNumber: Integer): TDateTime;

get the first day of the week with a specified weeknumber

function WeekNumberOfDate(ADate: TDate): Word;

get the week number of a specific day

function FirstDayOfWeek: Integer;

get the Windows setting for the first day of week; returns 1 = sunday; 2=monday, ...

function DayOfYear(ADate: TDate): Integer;

get the day number for a date

function FormattedStrToDateTime(const AFormat, ADateStr: WideString): TDateTime;

convert a formatted date string to a date

function DateTimeToISODateString (ADateTime: TDateTime; AZoneOffset: Double; AKind: TDateTimeKind = dtkDateTime): WideString;

convert a date to an ISO date (e.g. 2008-07-15T14:23:00+01:00

function ISODateStringToDateTime (AISOString: WideString; out AZoneOffset: Double): TDateTime;

convert an ISO date to a datetime

function FloatToISOFloatString (AFloat: Extended): WideString;

convert a float value

function ISOFloatStringToFloat ( AISOString: WideString): Extended;

convert a float ISO string value back to a float

function GetLongFilename (const AShortFileName: WideString ): WideString;

get a long filename with a short filename

function UNCToLocalFileName(const AFileName: WideString): WideString;

translate an UNC filename to a local (mapped) file name (if possible; else the UNC filename is returned)

function UniqueFileName (const AFileName: WideString; const ANumberLength: Integer = -1; const APreSeparator: WideString = '('; const APostSeparator: WideString = ')'; const AMultiDottedExtensionType: TMultiDottedExtensionType = mdetAllParts): WideString;

get a unique filename

procedure GetDuration (ADateTime: TDateTime; out days, hours, minutes, seconds, milliseconds: Word);

get a duration parameters

function GetDurationString (ADateTime: TDateTime; AFormat: TDateParts = [dpDays, dpHours, dpMinutes, dpSeconds]; OnlyFilled: Boolean = False; ShortStrings: Boolean = False): WideString;

get a formatted duration string

function GetDateTimeString (ADateTime: TDateTime; AFormat: TDateParts = [dpDays, dpHours, dpMinutes, dpSeconds]; OnlyFilled: Boolean = False; ShortStrings: Boolean = False): WideString;
 
procedure MsToTimeValues (AMs: Cardinal; out AHrs: Integer; out AMins: Integer; out ASecs: Integer; out AMils: Integer);

get the time elements of a number of milliseconds

function MsToTimeString (AMs: Cardinal; AParts: TDateParts = [dpMinutes, dpSeconds]; const ASeparator: String = ':'): String;

get a formatted time string of a number of milliseconds

function TimeStringToMs (const ATimeString, ATimeFormat: String): Cardinal;

get a the milliseconds of a formatted time string

function MsToDateTime (AMs: Cardinal): TDateTime;

convert a number of milliseconds to a date-time value

function DateTimeToMs (ADt: TDateTime): Cardinal;

convert a date time value to milliseconds

function LoadFileAsString (const AFileName: WideString): String;

get a file's content as string

function ShortStringStyle (const AString: WideString; const ALength: Integer = 8; const AFromLeft: Boolean = True; const APreString: WideString = '...'): WideString;

get a short version of a string

function WindowsSpecialFolder (const AMacroPath: WideString): WideString;

convert macros in a path to its full path (e.g. WindowsSpecialFolder('%systemroot%\System32') becomes 'c:\Windows\System32'

function WindowsHomeDir: WideString;

retrieve the windows temporary path

function WindowsTempDir: WideString;
 
function WindowsDir: WideString;
 
function WindowsSystemDir: WideString;
 
function WindowsMyPicturesDir: WideString;
 
function WindowsMyDocumentsDir: WideString;
 
function WindowsMyDownloadsDir: WideString;
 
function WindowsAppDataDir: WideString;
 
function WindowsDesktopDir: WideString;
 
function WindowsCacheDir: WideString;
 
function WindowsProgramsDir: WideString;
 
function WindowsSendToDir: WideString;
 
function IndexInStrings(AString: String; AStrings: TStrings; APartial: Boolean = False; ACaseSensitive: Boolean = False): Integer;

find a entry in a list of strings (TStrings) based on some criteria

function ParseVars (AString: WideString; AVars: TxomStrings; AValues: TxomStrings): WideString;

substitute a list of vars in a string with a list of values

function DecimalFrac (ANum: Extended): Integer;

return the fraction part as a integer

function FracInteger (ANum: Extended; APrecision: Integer = 6): Integer;

return the fraction part as a integer with optional precision

function RoundToPrecision (ANum: Extended; APrecision: Integer): Extended;

round a double to precision position where precision is factor for power of 10; e.g. 3 = 10ˆ3 = 1000, meaning the rounding will take place at the 1000th faction

function RoundToPrecisionForRange(const AValue: Double; const AMinRange, AMaxRange: Double): Double;

round a double to precision position that is most applicable to the range (higher range is less precision)

function CaretSystemPosition(var APoint: TPoint): Boolean;

get system wide cursor caret position

function ConstrainInt (AVal: Integer; AMin, AMax: Integer): Integer;

get a win control's caret position

function ConstrainInt64 (AVal: Int64; AMin, AMax: Int64): Int64;
 
function ConstrainFloat (AVal: Double; AMin, AMax: Double): Double;
 
function BetweenInt (AVal: Integer; AMin, AMax: Integer): Boolean;
 
function BetweenFloat (AVal: Double; AMin, AMax: Double): Boolean;
 
function BinaryCompare(const AStream1, AStream2: TStream; const AOnProgress: TSimpleProgressEvent = nil; const AProgressId: WideString = ''; const AStartPos: Int64 = 0; const AQuick: Boolean = False): Boolean;

compare 2 streams and return if they are exactly the same or not

function BinaryCompareFiles(const AFile1, AFile2: WideString; const AProgress: TSimpleProgressEvent = nil; const AProgressId: WideString = ''; const AStartPos: Int64 = 0; const AQuick: Boolean = False): Boolean;
 
function CheckBit (AValue: Integer; ABitNr: Byte): Boolean;

check if a specific bit number in an integer is set or not

function ByteToBinary(AByte: Byte): TBitArray;

convert a byte to an array of bits

function BinaryToByte(ABits: TBitArray): Byte;

convert an array of bits to a byte

function IntToBinaryString (AValue: Integer): String;

return the binary string of an integer (32 bits)

function WordToBinaryString (AValue: Integer): String;

return the binary string of a word (16 bits)

function ByteToBinaryString (AValue: Integer): String;

return the binary string of a byte (8 bits)

function ByteToFloat8 (const AByte: Byte): Single;

convert a Word value to a Floating Point 8 bits value (mini float)

function WordToFloat16 (const AWord: Word): Single;

convert a Word value to a Floating Point 16 bits value (half float)

function CardinalToFloat32 (const ACardinal: Cardinal): Single;

convert a Word value to a Floating Point 32 bits value (full float)

function FindJpegScale (ARequiredSize: Integer; AWidth: Integer; AHeight: Integer): TomJPEGScale;

return a scale based on a required size

function ExtractWord (const AText: WideString; const AWordNr: Integer; const ASeparator: WideString = ' '): WideString;

return the word at a specific position in a text; pass a negative number to get the words counting from the end e.g. AStr := 'Hallo my name is John'; Say (ExtractWord (AStr, 2)); // result = 'my' Say (ExtractWord (AStr, -2)); // result = 'is'

function DateToStrW (ADate: TDateTime): WideString; overload;

convert a date to a widestring

function DateToStrW (ADate: TDateTime; AFormatSettings: TFormatSettings): WideString; overload;
 
function TimeToStrW (ATime: TDateTime): WideString; overload;
 
function TimeToStrW (ATime: TDateTime; AFormatSettings: TFormatSettings): WideString; overload;
 
function FormatDateTimeW(const AFormatStr: String; ADateTime: TDateTime): WideString; overload;
 
function FormatDateTimeW(const AFormatStr: String; ADateTime: TDateTime; const AFormatSettings: TFormatSettings): WideString; overload;
 
function IntToStrW (const AInt: Integer): WideString; overload;

convert an integer to a widestring

function IntToStrW (const AInt: Int64): WideString; overload;
 
function IntToStrW (const AInt: Qword): WideString; overload;
 
function IntToStrA (AInt: Integer): AnsiString; overload;
 
function IntToStrA (AInt: Int64): AnsiString; overload;
 
function WStrToInt (const AStr: WideString): Integer;
 
function WStrToInt64(const AStr: WideString): Int64;
 
function WStrToFloat(const AStr: WideString): Extended; overload;
 
Function WStrToFloat(const AStr: WideString; const AFormatSettings: TFormatSettings) : Extended; overload;
 
function StrToHex (const AStr: String): AnsiString;

convert a string to a hexadecimal string; returning a string of 2 digit hex value for every character in the string

function HexToStr (const AHexStr: AnsiString): String;

convert a hex string to an ansi string

function WideStrToHex (const AStr: WideString): String;

convert a widestring to a hexadecimal string; returning a string of 2 digit hex value for every character in the string

function HexToWideStr (const AHexStr: String): WideString;

convert a hex string to a wide string

procedure HexToStream (const AHexStr: String; AStream: TStream);

convert a hex string to a binary stream

function StreamToHex(AStream: TStream): String;

convert a binary stream to a hex string

function HashCode(const s: String; Seed: LongWord=$9747b28c): Int64;

return a hash code for a specific string

function HashStringForStream(const AStream: TStream; AHashLength: Integer = 8; AStreamCount: Int64 = 0; AStartPos: Int64 = 0; AAsHex: Boolean = False): AnsiString;

return a hash string for a specific stream

function HashStringForFile(const AFileName: WideString; AByteCount: Int64 = 1024*10): String;

return a hash string for a specific file; by default the first 10KB is used as the hash

function QuickHashStringForStream(const AStream: TStream): String;

return a hash string for a stream; this hashed the first 50K + the last 50K of the file, including the file size

function QuickHashStringForFile(const AFileName: WideString): String;

return a hash string for a file; also see QuickHashStringForStream

function HashStringForFileList (AFiles: TxomStringList; AByteCountPerFile: Int64 = 1024*10): String;

return a hash string for a set of files

function HashStringForFolder (AFolder: WideString; ARecursive: Boolean): String;

return a hash string for a full folder

function HashStr(const StringIn: PAnsiChar; AHashLength: Integer = 8): String;

return a hash string for a specific (long) string pointer

function HashString(const AString: AnsiString; AHashLength: Integer = 8): String;

return a hash string for a specific string

function WideHashString(const AString: WideString; AHashLength: Integer = 8): String;

return a hash string for a specific wide string

function SHA256HashFromStream (AStream: TStream): String;

return a SHA256 hash string for a specific stream

function SHA256Hash (const AString: WideString): String;

return a SHA256 hash string for a specific (wide)string

function HMACSHA1_Base64(const AKey, AMessage: string): string;

return a Base64 encoded HMAC'ed SHA1 hash

function ChecksumForStream (AStream: TStream): String;

return a 256 lenth hex checksum for a stream

function ChecksumForFile (const AFileName: WideString): String;

return a 256 lenth hex checksum for a file

function Base64Encode (const AString: String): String;

encode a base64 string

function Base64Decode (const AString: String): String;

decode a base64 string

procedure Base64EncodeStreamToStream (AStream, AResult: TStream; ALineLength: Integer = 0);

encode a base64 Stream to a stream

function Base64EncodeStream (AStream: TStream): AnsiString;

encode a base64 Stream to string

procedure Base64DecodeString (const AString: String; AStream: TStream; AStrict: Boolean = False);

decode a base64 string to stream

function FileNameToURI(const AFileName: WideString): AnsiString;

convert a file name to a URI filename

function EncryptStream (const AKey: AnsiString; AStream, AOutput: TStream): Int64;

encrypt a stream with AES/SHA256

function DecryptStream (const AKey: AnsiString; AStream, AOutput: TStream): Int64;

decrypt a stream that is AES/SHA256 encrypted

function EncryptString (const AKey: AnsiString; const AString: AnsiString): AnsiString;

encrypt a string with AES/SHA256

function DecryptString (const AKey: AnsiString; const AString: AnsiString): AnsiString;

decrypt a string that is AES/SHA256 encrypted

procedure WriteVariantToStream(const AValue: Variant; AStream: TStream);

write a variant value to a stream

function ReadVariantFromStream(AStream: TStream): Variant;

read a variant value from a stream

procedure SetApplicationCode (const Value: String);

previous public routines

procedure SetCompany (const Value: String);
 
function GetApplicationCode: String;
 
function GetCompany: String;
 
procedure RenameCompany (const AOldName, ANewName: String);
 
function DefaultConfigDir: WideString;
 
function DefaultAppDataDir: WideString;
 
function DefaultResourceDir: WideString;
 
function DefaultApplicationDir: WideString;
 
function DefaultLogDir: WideString;
 
function RegistryKey: String;
 
function ReadFromRegistry (const sSection, sKeyValue: String; DefaultValue: Variant): Variant;

read a value from the application's registry section. The DefaultValue will be returned if no value exists

function ReadStreamFromRegistry (const sSection, sKeyValue: String; AStream: TStream): Boolean;

read a binary stream from the application's registry section

procedure WriteToRegistry (const sSection, sKeyValue: String; Value: Variant);

write a value in a specified key of the application's registry section. The method will determine the type of the value and create an according registry typed entry

procedure WriteStreamToRegistry (const sSection, sKeyValue: String; AStream: TStream);

write a stream as binary in a specified key of the application's registry section

procedure DeleteFromRegistry (const sSection, sKeyValue: String);

delete a registry key from the application's registry section

function RegistryKeyExists (const sSection, sKeyValue: String): Boolean;

return is a certain registry key exists in the application's registry section

procedure EnumKeysFromRegistry (const sSection: String; sKeyValues: TStrings);

populate a list of existing keys in the application's registry section

procedure EnumValuesFromRegistry (const sSection: String; sValues: TStrings);

populate a list of existing values in the application's registry section

procedure RenameRegistryValue (const sSection, sKeyValue, ANewName: String);

rename an existing key in the application's registry section

function BackupRegistry (const AFileName: WideString): Boolean;

restore the registry for this application to file. The file is restored to the key as specified with SetCompany and SetApplicationCode

function RestoreRegistry (const AFileName: WideString): Boolean;

restore the registry for this application from file. The file is restored to the key as specified with SetCompany and SetApplicationCode

procedure RegistryBeginUpdate;

begin an update session for the registry

procedure RegistryEndUpdate;

end an update session for the registry

function Val (const vInput: Variant): Variant;

return the input value casted to a variant

function VarIsNull(const V: Variant): Boolean;
 
function VarIsEmpty(const V: Variant): Boolean;
 
function QuotedStrW (const AStr: WideString): WideString;
 
function Tokenize(sStr, sSeperator: WideString; AStrings: TxomStrings): Integer;

Parses a string into substrings (tokens) based on specified separator. EML uses delimiters to recognize the beginning and end of each substring.

function AnsiTokenize(sStr, sSeperator: String; AStrings: TStrings): Integer;
 
function TokenizeSpecial (const sStr: WideString; AStrings: TxomStrings; AMinimumTokenLength: Integer = 0): Integer;

Each token is a contiguous sequence of eligible characters, where eligible characters are all alphanumeric characters; 0 to 9, the underscore "_", the period "." the comma ",", the semi-colon ":" all other characters are operators where space " ", tilde "˜", plus "+", minus "-", open bracket "(" and closed bracket ")" are special characters because the sign is added to the next token special characters " ", "+", "-", can be be escaped by repeating them (e.g. book–shelf becomes book-shelf and not book minus shelf

function FormatToProperCSV (const AString: WideString; const ADelimiter: WideChar = ','; AQuoteChar: WideChar = '"'; const ADelimiterEscapeCharacter: WideChar = '\'): WideString;
 
function StrTran (const sSourceStr, sSeekStr, sReplaceStr: WideString): WideString;

StrTran scans sSourceStr and case insensitively replaces all occurrences of eSeekStr with eReplaceStr and returns the resulting string

function EscapeString(const value: string): string;
 
function Escape(const Value: Widestring): string;
 
function UnEscape(const Value: AnsiString): Widestring;
 
function StripJsonSlashComments(const S: Ansistring): AnsiString;
 
function FileMimeType (const AFileName: WideString): WideString;
 
function iif(const ACondition: Boolean; const ATrueValue, AFalseValue: Variant): Variant;
 
function Nvl(const AValue: Variant; const ADefaultValue: Variant): Variant;
 
function AddLeadingChars(const AStr: WideString; ALeadChr: WideString; const ALength: Integer; const DoAfter: Boolean = False): WideString;
 
function RemoveLeadingChars(const AStr: WideString; ALeadChr: WideString): WideString;
 
function ReadLine (AStream: TStream; var AString: AnsiString): Boolean;

read a line of text from a stream

procedure WriteLine (AStream: TStream; const sLine: WideString);

write a line of text to a stream

function SeekInStream (AStream: TStream; sText: WideString): boolean;

search for a specific text in a stream

function FindTextInStream(AStream: TStream; Offset: int64; const AString: AnsiString; CaseSensitive: boolean = True): int64;

search for a text in a stream and return the position

function ArrayIntScan (const AArray: Array of Integer; nValue: Integer): Integer;
 
function ArrayToString (const AArray: TDynamicStringArray; const ASeparator: String): String;
 
procedure StringToArray (const AString, ASeparator: String; var AArray: TDynamicStringArray);
 
function GetLocalMachineName: WideString;
 
function PreventComputerFromSleeping: PtrInt;
 
procedure UndoPreventComputerFromSleeping(const AActivity: PtrInt);
 
function IsFileExcludedFromBackup(const AFileName: WideString; var AError: WideString): Boolean;
 
function ExcludeFileFromBackup(const AFileName: WideString; var AError: WideString): Boolean;
 
function IncludeFileInBackup(const AFileName: WideString; var AError: WideString): Boolean;
 
function IsFolderExcludedFromBackup(const AFolder: WideString; var AError: WideString): Boolean;
 
function ExcludeFolderFromBackup(const AFolder: WideString; var AError: WideString): Boolean;
 
function IncludeFolderInBackup(const AFolder: WideString; var AError: WideString): Boolean;
 
function IsDevelopMode: Boolean;
 
function CompareInt (AInt1, AInt2: Integer): Integer;

compare two integer values.

if int1 < int2 ==> result = -1 if int1 = int2 ==> result = 0 if int1 > int2 ==> result = 1

This routine is usually called for sorting purposes

function CompareInt64 (AInt1, AInt2: Int64): Integer;
 
function IsValidNumberString (const ANumberStr: WideString; AIsHex: Boolean = False; ADecimalSeparator: String = ''; AAllowSigned: Boolean = True): Boolean;

return if a passed string exists of numbers or not. Optionally specify if the string is decimal or hexadecimal

function IsValidIntNumberString (const ANumberStr: WideString; AIsHex: Boolean = False; AAllowSigned: Boolean = True): Boolean;

return if a passed string exists of integer numbers

function IsValidRationalString(const AStr: WideString): Boolean;

return if a passed string is a valid rational fraction formatted string Nom/Denom...(eg "123/456")

function IsValidRationalStringValues(const AStr: WideString; var ANom, ADenom: Double): Boolean;

return if a passed string is a valid rational fraction formatted string Nom/Denom...(eg "123/456")

function InitCaps(const AText: WideString): WideString;

convert a string to init-caps format (each new word starts with a capital, rest lowercase)

function HexToInt(const HexStr: WideString): Cardinal;

convert a hexadecimal string to a cardinal (unsigned)

function HexToSignedInt(const HexStr: string; byteSize: Integer): Variant;

convert a hexadecimal value to a signed int

function SignedIntToHex(value: Int64; byteSize: Integer): String;

convert an int value to hex string with optional byte size

function RangedInteger(AValue, MinValue, MaxValue: Integer): Integer;

returns a number that is corrected if out of range

procedure BackupFile (const AFileName: WideString; const ATargetPath: WideString = '');

backup a file to a specific target folder

function GetSizeString (ASize: Int64; SizeStyle: TSizeStyle = ssChoose; AddStyleIndicator: Boolean = True): WideString;

return a numeric value to a formatted size

function SizeString (ASize: Int64): WideString;

return a numeric value to a formatted size (also see GetSizeString)

function TimePassedString (ADelta: TDateTime): WideString;

return a string to represent a time delta

function StrAsDate (const AStr: String): TDate;

required string format = yyyymmdd, with minimal yyyymm

function CreateClassID(AClean: Boolean = False): string;

return a unique class ID (guid)

function NewGUID(AClean: Boolean = True): String;

return a new unique identifier (GUID);

function IsSameGUID(const AGuid1, AGuid2: TGUID): Boolean;

compare two TGUID types

function ExtractNumberFromString(const AString: WideString; const AFormatSettings: TFormatSettings; var AResult: Double): Boolean;

extract number from a string and return as a double

function ExtractNumbersInString(const AString: WideString): WideString;

return the numeric digits from a string

function OSPlatform: WideString;

return the platform

function OSTrivialName: WideString;

return the operating system trivial name (eg Sequoia);

function OSVersion: WideString;

return the operating system version

function OpenHTTPAddress (AHandle: HWND; const AHTTPAddress: WideString): Integer;
 
function ExecuteWaitFile( const ExeFile, Parameters: string): Boolean;
 
function ShellDoExecuteOperation (AHandle: HWND; const AExecuteCommand, AOperation: WideString): Integer;
 
function ShellDoExecute (AHandle: HWND; const AExecuteCommand: WideString): Integer;
 
function GetStartButton: HWND;
 
function OSTimeZoneName: WideString;

return the IANA time zone name

function OSCountryCode: WideString;

return the Country code as defined in the OS

function OSMeasurementSystem: TMeasurementSystem;

return the Measurement system for the OS (based on the country)

function InstalledMemory(InMegabytes: Boolean = False): Int64;

return the size of the installed system memory in bytes

function AvailableMemory(InMegabytes: Boolean = False): Int64;

return the size of the available system memory in bytes

function CurrentMemoryUsage: Int64;

return the size of the memory in use by the current application process

function InstalledProcessors: Cardinal;

return the number installed system processors/cores

function UniqueSystemID: String;

return a unique 32 character string for this computer

function HTMLStrip ( AHTML: WideString): WideString;

remove HTML tags from a string

procedure RegisterDLL (const AActiveXFileName: WideString);

register a ActiveX or COM server

procedure UnregisterDLL (const AActiveXFileName: WideString);

unregister a ActiveX or COM server

function IsRunningAsService: Boolean;
 
function IsRunningAsDLL: Boolean;
 
function InstanceLibraryName: String;
 
function BuildValidFileName(const AFileName: WideString; ADrastic: Boolean = True): WideString;

return a valid filename

function FixFileName ( AFileName: WideString): WideString;

remove double directory separators, and line feeds in a file name

function FindStringInStream(AStream: TStream; const AID: AnsiString; out APosition: Int64; AOffset: Int64 = 0; AReversed: Boolean = False; AInstanceCount: Integer = 1; AStopPosition: Int64 = 0): Boolean;

find a specific string in a stream

function CopyStreamInBlocks(ASource, ATarget: TStream; ACopyBytes: Int64; const ABlockSize: Int64 = 1024 * 100): Int64;

copy a source stream to a target stream, using a specified block size; returns the number of bytes copied

procedure InvertBuffer (var ABuffer: Array of Byte; ALength: Integer);

stream helper functions

procedure InvertBuffer2 (var ABuffer: Array of Char; ALength: Integer);
 
function StreamRead (AStream: TStream; out ABuffer: Array of Byte; ACount: Integer; AOrder: TByteOrder): Integer;
 
function StreamRead2 (AStream: TStream; var ABuffer: Array of Char; ACount: Integer; AOrder: TByteOrder): Integer;
 
function StreamWrite (AStream: TStream; var ABuffer: Array of Byte; ACount: Integer; AOrder: TByteOrder): Integer;
 
function StreamWrite2 (AStream: TStream; var ABuffer: Array of Char; ACount: Integer; AOrder: TByteOrder): Integer;
 
function StreamInvert (AStream: TStream; AOrder: TByteOrder; BlockSize: Integer = -1): Integer;
 
function StreamInvertBlock (AStream: TStream; BlockSize: Integer = -1): Integer;
 
procedure StreamReadUInt64 (AStream: TStream; out AInt: QWord; AOrder: TByteOrder);
 
procedure StreamWriteUInt64 (AStream: TStream; AInt: QWord; AOrder: TByteOrder);
 
procedure StreamReadInt64 (AStream: TStream; out AInt: Int64; AOrder: TByteOrder);
 
procedure StreamWriteInt64 (AStream: TStream; AInt: Int64; AOrder: TByteOrder);
 
procedure StreamReadUInt32 (AStream: TStream; out AInt: Cardinal; AOrder: TByteOrder);
 
procedure StreamWriteUInt32 (AStream: TStream; AInt: Cardinal; AOrder: TByteOrder);
 
procedure StreamReadInt32 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
 
procedure StreamWriteInt32 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
 
procedure StreamReadInt16 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
 
procedure StreamWriteInt16 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
 
procedure StreamReadUInt16 (AStream: TStream; out AInt: Word; AOrder: TByteOrder);
 
procedure StreamWriteUInt16 (AStream: TStream; AInt: Word; AOrder: TByteOrder);
 
procedure StreamReadUInt8 (AStream: TStream; out AInt: Byte; AOrder: TByteOrder);
 
procedure StreamWriteUInt8 (AStream: TStream; AInt: Byte; AOrder: TByteOrder);
 
procedure StreamReadUIntVar (AStream: TStream; out AInt: QWord; ASize: Byte; AOrder: TByteOrder);
 
procedure StreamWriteUIntVar (AStream: TStream; AInt: QWord; ASize: Byte; AOrder: TByteOrder);
 
procedure StreamReadInt8 (AStream: TStream; out AInt: Integer; AOrder: TByteOrder);
 
procedure StreamWriteInt8 (AStream: TStream; AInt: Integer; AOrder: TByteOrder);
 
procedure StreamReadFloat32 (AStream: TStream; out AFloat: Single; AOrder: TByteOrder);
 
procedure StreamWriteFloat32 (AStream: TStream; AFloat: Single; AOrder: TByteOrder);
 
procedure InitLanguage;
 

Types

WideChar = System.WideChar;
 
TBitArray = Array[1..8] of Boolean;
 
TDynamicStringArray = Array of String;
 
TFileTimeType = (...);
 
Values
  • ftCreated
  • ftModified
  • ftAccessed
TMultiDottedExtensionType = (...);
 
Values
  • mdetAllParts
  • mdetLastPart
TSimpleProgressEvent = procedure (Sender: TObject; AId: WideString; APosition: Integer; var ACancel: Boolean) of object;
 
TProxySettingsEvent = procedure (out AUseProxy: Boolean; out AHost: String; out APort: Integer; out AUser: String; out APassword: String) of object;
 
TSystemUIMode = (...);
 
Values
  • UIModeNormal
  • UIModeContentSuppressed
  • UIModeContentHidden
  • UIModeAllHidden
  • UIModeAllSuppressed
TSystemUIOption = (...);
 
Values
  • UIOptionAutoShowMenuBar
  • UIOptionAnimateMenuBar
  • UIOptionDisableAppleMenu
  • UIOptionDisableProcessSwitch
  • UIOptionDisableForceQuit
  • UIOptionDisableSessionTerminate
  • UIOptionDisableHide
TSystemUIOptions = set of TSystemUIOption;
 
TSeason = (...);
 
Values
  • seaSummer
  • seaFall
  • seaWinter
  • seaSpring
TSeasons = set of TSeason;
 

Constants

ssMultiSelect : TShiftStateEnum = ssMeta;

for TColor

CrLf : AnsiString = #13#10;
 
CrLf2 : AnsiString = #13#10#13#10;
 
LfCr : AnsiString = #10#13;
 
LfCr2 : AnsiString = #10#13#10#13;
 
CrLfW : WideString = System.WideChar(#13) + System.WideChar(#10);
 
CrLf2W : WideString = System.WideChar(#13) + System.WideChar(#10) + System.WideChar(#13) + System.WideChar(#10);
 
LfCrW : WideString = System.WideChar(#10) + System.WideChar(#13);
 
LfCr2W : WideString = System.WideChar(#10) + System.WideChar(#13) + System.WideChar(#10) + System.WideChar(#13);
 
DefaultTimeZone: Double = -9999;
 

Variables

StartupMoment: TDateTime = 0.0;

constant which can be used to specify the timezone of the system

ComputerGUID: String = '';
 
RunSessionGUID: String = '';
 
IsServerOS: Boolean = False;
 
TimeZoneOffset: Double;
 
VistaDialogsEnabled: Boolean;
 
gClipbrdFormat: TClipboardFormat;
 
gClipbrdTextFormat: TClipboardFormat;
 
GlobalProxySettings: TProxySettingsEvent = nil;
 
IntlFormatSettings: TFormatSettings = ( CurrencyFormat: 1; NegCurrFormat: 5; ThousandSeparator: ','; DecimalSeparator: '.'; CurrencyDecimals: 2; DateSeparator: '/'; TimeSeparator: ':'; ListSeparator: ','; CurrencyString: '$'; ShortDateFormat: 'd/m/y'; LongDateFormat: 'dd" "mmmm" "yyyy'; TimeAMString: 'AM'; TimePMString: 'PM'; ShortTimeFormat: 'hh:nn'; LongTimeFormat: 'hh:nn:ss'; ShortMonthNames: ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'); LongMonthNames: ('January','February','March','April','May','June', 'July','August','September','October','November','December'); ShortDayNames: ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); LongDayNames: ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); TwoDigitYearCenturyWindow: 50; );
 

Generated by PasDoc 0.15.0.